Class FileLogger
java.lang.Object
org.apache.maven.shared.scriptinterpreter.FileLogger
- All Implemented Interfaces:
AutoCloseable
,ExecutionLogger
FileLogger class.
-
Constructor Summary
ConstructorDescriptionFileLogger
(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 TypeMethodDescriptionvoid
close()
Closes the underlying file stream.void
consumeLine
(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:
getPrintStream
in 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:
consumeLine
in interfaceExecutionLogger
- Parameters:
line
- The message to log.
-
close
public void close()Closes the underlying file stream.- Specified by:
close
in interfaceAutoCloseable
-