Class JobStartStopLogger
Object
JobStartStopLogger
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 Summary
ConstructorsConstructorDescriptionJobStartStopLogger(String jobDescriptionText, ConcurrentJobMonitor monitor, boolean showHashSeperators, int showOngoingJobsLessThan, Optional<MessageLogger> logger) Creates a job-logger. -
Method Summary
Modifier and TypeMethodDescriptionvoidlogEnd(JobDescription job, JobStateMonitor monitor) Performs logging for when a job ends.voidlogStart(JobDescription job) Performs logging for when a job starts.
-
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
Performs logging for when a job starts.- Parameters:
job- the job that was started.
-
logEnd
Performs logging for when a job ends.- Parameters:
job- the job that ended.monitor- tracks the execution-state of a job.
-