Class TextFileMessageLogger
Object
org.anchoranalysis.experiment.log.TextFileMessageLogger
- All Implemented Interfaces:
MessageLogger,StatefulMessageLogger
public class TextFileMessageLogger extends Object implements StatefulMessageLogger
Logs messages to a text-file.
Both the path of text-file can be determined in different ways by the constructor, and whether it is written at all.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description TextFileMessageLogger(String filePath, ErrorReporter errorReporter)Constructs a logger that (always) writes messages to a text-file with a specific path.TextFileMessageLogger(String outputName, OutputterChecked outputter, ErrorReporter errorReporter)Constructs a logger that (maybe) writes messages to a text-file, with a path based upon an output name applied to aOutputterChecked. -
Method Summary
-
Constructor Details
-
TextFileMessageLogger
Constructs a logger that (always) writes messages to a text-file with a specific path.- Parameters:
filePath- path to write the log toerrorReporter- error-reporter an error is outputted here if the log cannot be created, and no further logging occurs.
-
TextFileMessageLogger
public TextFileMessageLogger(String outputName, OutputterChecked outputter, ErrorReporter errorReporter)Constructs a logger that (maybe) writes messages to a text-file, with a path based upon an output name applied to aOutputterChecked.The message-log will only be outputted, if allowed by the
OutputterChecked.- Parameters:
outputName- output-nameoutputter- output-managererrorReporter- error-reporter an error is outputted here if the log cannot be created, and no further logging occurs.
-
-
Method Details
-
logFormatted
- Specified by:
logFormattedin interfaceMessageLogger
-
start
Description copied from interface:StatefulMessageLoggerStarts logging.This must be called once before any logging occurs.
- Specified by:
startin interfaceStatefulMessageLogger- Throws:
OperationFailedException- if logging cannot be successfully started.
-
log
- Specified by:
login interfaceMessageLogger
-
close
public void close(boolean successful, boolean warningOccurred)Description copied from interface:StatefulMessageLoggerStops logging.This must be called once after all logging has occurred.
- Specified by:
closein interfaceStatefulMessageLogger- Parameters:
successful- true when the task completed successfully.warningOccurred- true if at least one warning has occurred, false otherwise.
-