Class FailureOnlyMessageLogger
Object
FailureOnlyMessageLogger
- All Implemented Interfaces:
MessageLogger,StatefulMessageLogger
Writes text to a file, but only if
close(boolean, boolean) is called with successful==true.
The text cannot be written immediately, so is saved until close(boolean, boolean) is called.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionFailureOnlyMessageLogger(String outputName, OutputterChecked outputter, ErrorReporter errorReporter, boolean considerWarningAsFailure) Creates a newFailureOnlyMessageLoggerinstance. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.anchoranalysis.core.log.MessageLogger
logEmptyLine
-
Constructor Details
-
FailureOnlyMessageLogger
public FailureOnlyMessageLogger(String outputName, OutputterChecked outputter, ErrorReporter errorReporter, boolean considerWarningAsFailure) Creates a newFailureOnlyMessageLoggerinstance.- Parameters:
outputName-outputter-errorReporter-considerWarningAsFailure- If true, any warning message is considered as a failure.
-
-
Method Details
-
log
Description copied from interface:MessageLoggerLogs a message.- Specified by:
login interfaceMessageLogger- Parameters:
message- the message to log.
-
logFormatted
Description copied from interface:MessageLoggerLogs a message, derived from a format-string.- Specified by:
logFormattedin interfaceMessageLogger- Parameters:
formatString- a format string like inString.format(java.lang.String, java.lang.Object...).args- the arguments that match the placeholder informatStringlike inString.format(java.lang.String, java.lang.Object...).
-
start
public void start()Description copied from interface:StatefulMessageLoggerStarts logging.This must be called once before any logging occurs.
- Specified by:
startin interfaceStatefulMessageLogger
-
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.
-