Class EngineLoggingFactory.FileLogger

java.lang.Object
com.blackrook.engine.EngineLoggingFactory.FileLogger
All Implemented Interfaces:
EngineLoggingFactory.Driver
Enclosing class:
EngineLoggingFactory

public static class EngineLoggingFactory.FileLogger extends Object implements EngineLoggingFactory.Driver
A logging driver that writes to a text file.
Author:
Matthew Tropiano
  • Constructor Details

    • FileLogger

      public FileLogger(File logFile) throws IOException
      Creates a new file logger the writes to a specific file.
      Parameters:
      logFile - the file to write to.
      Throws:
      IOException - if the file could not be opened.
  • Method Details

    • setFile

      protected void setFile(File logFile) throws IOException
      Sets the log file to a new file. The previous file is closed.
      Parameters:
      logFile - the file to write to.
      Throws:
      IOException - if the file could not be opened.
    • closeFile

      protected void closeFile(File closeFile) throws IOException
      Called after the writer to the previous file is closed on a file switch via setFile(File)
      Parameters:
      closeFile - the file that was closed.
      Throws:
      IOException - if the file could not be closed cleanly.
    • log

      public void log(Date time, EngineLoggingFactory.LogLevel level, String source, String message, Throwable throwable)
      Description copied from interface: EngineLoggingFactory.Driver
      Processes a logging message.
      Specified by:
      log in interface EngineLoggingFactory.Driver
      Parameters:
      time - the time that this message was logged.
      level - the logging level.
      source - the source of the message.
      message - the message to object.
      throwable - the throwable to output along with the message.