Class FailureOnlyMessageLogger

Object
FailureOnlyMessageLogger
All Implemented Interfaces:
MessageLogger, StatefulMessageLogger

public class FailureOnlyMessageLogger extends Object implements 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 Details

    • FailureOnlyMessageLogger

      public FailureOnlyMessageLogger(String outputName, OutputterChecked outputter, ErrorReporter errorReporter, boolean considerWarningAsFailure)
      Creates a new FailureOnlyMessageLogger instance.
      Parameters:
      outputName -
      outputter -
      errorReporter -
      considerWarningAsFailure - If true, any warning message is considered as a failure.
  • Method Details

    • log

      public void log(String message)
      Specified by:
      log in interface MessageLogger
    • logFormatted

      public void logFormatted(String formatString, Object... args)
      Specified by:
      logFormatted in interface MessageLogger
    • start

      public void start()
      Description copied from interface: StatefulMessageLogger
      Starts logging.

      This must be called once before any logging occurs.

      Specified by:
      start in interface StatefulMessageLogger
    • close

      public void close(boolean successful, boolean warningOccurred)
      Description copied from interface: StatefulMessageLogger
      Stops logging.

      This must be called once after all logging has occurred.

      Specified by:
      close in interface StatefulMessageLogger
      Parameters:
      successful - true when the task completed successfully.
      warningOccurred - true if at least one warning has occurred, false otherwise.