Class FileLogger
java.lang.Object
org.apache.maven.shared.scriptinterpreter.FileLogger
- All Implemented Interfaces:
AutoCloseable,ExecutionLogger
FileLogger class.
-
Constructor Summary
ConstructorsConstructorDescriptionFileLogger(File outputFile) Creates a new logger that writes to the specified file.FileLogger(File outputFile, FileLoggerMirrorHandler mirrorHandler) Creates a new logger that writes to the specified file and optionally mirrors messages. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the underlying file stream.voidconsumeLine(String line) Writes the specified line to the log file and invokeFileLoggerMirrorHandler.consumeOutput(String)if is given.Gets the path to the output file.Gets the underlying stream used to write message to the log file.
-
Constructor Details
-
FileLogger
Creates a new logger that writes to the specified file.- Parameters:
outputFile- The path to the output file, if null all message will be discarded.- Throws:
IOException- If the output file could not be created.
-
-
Method Details
-
getOutputFile
Gets the path to the output file.- Returns:
- The path to the output file, never
null.
-
getPrintStream
Gets the underlying stream used to write message to the log file.- Specified by:
getPrintStreamin interfaceExecutionLogger- Returns:
- The underlying stream used to write message to the log file, never
null.
-
consumeLine
Writes the specified line to the log file and invokeFileLoggerMirrorHandler.consumeOutput(String)if is given.- Specified by:
consumeLinein interfaceExecutionLogger- Parameters:
line- The message to log.
-
close
public void close()Closes the underlying file stream.- Specified by:
closein interfaceAutoCloseable
-