Class JobStartStopLogger

Object
JobStartStopLogger

public class JobStartStopLogger extends Object
Logs events when jobs start and stop, with or without errors.

The class is thread-safe as there might be multiple calls in parallel.

Author:
Owen Feehan
  • Constructor Details

    • JobStartStopLogger

      public JobStartStopLogger(String jobDescriptionText, ConcurrentJobMonitor monitor, boolean showHashSeperators, int showOngoingJobsLessThan, Optional<MessageLogger> logger)
      Creates a job-logger.
      Parameters:
      jobDescriptionText - a noun describing the job that appears in the log e.g. "Job"
      monitor - monitors the progress of jobs.
      showHashSeperators - indicates if lines of hashes should be placed before and after each log message (adds emphasis).
      showOngoingJobsLessThan - When the number of ongoing jobs is less than this threshold, they are shown in event logs. 0 disables.
      logger - write messages to logger, if defined.
  • Method Details

    • logStart

      public void logStart(JobDescription job)
      Performs logging for when a job starts.
      Parameters:
      job - the job that was started.
    • logEnd

      public void logEnd(JobDescription job, JobStateMonitor monitor)
      Performs logging for when a job ends.
      Parameters:
      job - the job that ended.
      monitor - tracks the execution-state of a job.