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 Summary
ConstructorsConstructorDescriptionFileLogger(File logFile) Creates a new file logger the writes to a specific file. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCalled after the writer to the previous file is closed on a file switch viasetFile(File)voidlog(Date time, EngineLoggingFactory.LogLevel level, String source, String message, Throwable throwable) Processes a logging message.protected voidSets the log file to a new file.
-
Constructor Details
-
FileLogger
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
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
Called after the writer to the previous file is closed on a file switch viasetFile(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.DriverProcesses a logging message.- Specified by:
login interfaceEngineLoggingFactory.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.
-