Class DefaultFileLogHandler

  • All Implemented Interfaces:
    ILogHandler, java.lang.AutoCloseable

    public final class DefaultFileLogHandler
    extends AbstractLogHandler
    A standard file logger for this LoggingAPI. All important configurations can be made in the constructor
    • Constructor Detail

      • DefaultFileLogHandler

        @Deprecated
        public DefaultFileLogHandler​(java.io.File directory,
                                     java.lang.String pattern,
                                     long maxBytes)
        Deprecated.
        The default constructor with all important configuration
        Parameters:
        directory - the default storage for the log files
        pattern - the file pattern, for the log files like "app.log" will be to than "app.log.0"
        maxBytes - the maximum bytes, that a log file should have, to switch to the next log file
      • DefaultFileLogHandler

        public DefaultFileLogHandler​(java.nio.file.Path directory,
                                     java.lang.String pattern,
                                     long maxBytes)
    • Method Detail

      • setEnableErrorLog

        public DefaultFileLogHandler setEnableErrorLog​(boolean enableErrorLog)
                                                throws java.io.IOException
        Enables/disables the error log file (directory/error.log)
        Parameters:
        enableErrorLog - if the file should be created and filled with every error in the console
        Throws:
        java.io.IOException
      • handle

        public void handle​(@NotNull
                           @NotNull LogEntry logEntry)
                    throws java.lang.Exception
        Description copied from interface: ILogHandler
        Allows to handle this incoming LogEntry from the logger This method can invoked asynchronously or synchronously. It depends on the implementation of the logger and the setting of the LogLevel
        Parameters:
        logEntry - the new incoming log entry
        Throws:
        java.lang.Exception
      • close

        public void close()
                   throws java.lang.Exception
        Specified by:
        close in interface java.lang.AutoCloseable
        Overrides:
        close in class AbstractLogHandler
        Throws:
        java.lang.Exception
      • getDirectory

        public java.nio.file.Path getDirectory()
      • getPattern

        public java.lang.String getPattern()
      • getMaxBytes

        public long getMaxBytes()
      • getEntry

        public java.nio.file.Path getEntry()
      • getWrittenBytes

        public long getWrittenBytes()