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

        public DefaultFileLogHandler​(java.io.File directory,
                                     java.lang.String pattern,
                                     long maxBytes)
        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
    • 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​(LogEntry logEntry)
        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
      • close

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

        public java.io.File getDirectory()
      • getPattern

        public java.lang.String getPattern()
      • getMaxBytes

        public long getMaxBytes()
      • getEntry

        public java.io.File getEntry()
      • getPrintWriter

        public java.io.PrintWriter getPrintWriter()
      • getWritternBytes

        public long getWritternBytes()