public interface ProgressLogger
Logger used by IRI that implements a logic to report the progress of a single
task.
The progress is calculated by comparing the current step to the expected step count and shown as a percentage value.| Modifier and Type | Method and Description |
|---|---|
ProgressLogger |
abort()
Marks the task as failed and triggers the output of a status message informing us about the failure.
|
ProgressLogger |
abort(Throwable reason)
Marks the task as failed and triggers the output of a status message informing us about the failure.
|
ProgressLogger |
finish()
Sets the current step to the expected step count and triggers the output of the current progress.
|
int |
getCurrentStep()
Returns the current finished step of this logger.
|
boolean |
getEnabled()
This method is the getter for the enabled flag of the logger.
|
int |
getStepCount()
Returns the expected step count of this logger.
|
ProgressLogger |
progress()
Increases the current step by one and triggers the output of the current progress.
|
ProgressLogger |
progress(int currentStep)
Sets the current step to the given value and triggers the output of the current progress.
|
ProgressLogger |
setCurrentStep(int currentStep)
Sets the current step to the given value without triggering an output.
|
ProgressLogger |
setEnabled(boolean enabled)
This method is the setter for the enabled flag of the logger.
|
ProgressLogger |
setStepCount(int stepCount)
Sets the expected step count to the given value without triggering an output.
|
ProgressLogger |
start()
Starts the logging by (re)setting the current step to 0 and trigger the output of the current progress.
|
ProgressLogger |
start(int stepCount)
Does the same as
start() but sets the expected step count to the given value. |
ProgressLogger start()
ProgressLogger start(int stepCount)
start() but sets the expected step count to the given value.
This allows us to initialize and start the logging in a single call.stepCount - number of steps that the task involvesProgressLogger progress()
ProgressLogger progress(int currentStep)
currentStep - the current step that was just finishedProgressLogger finish()
ProgressLogger abort()
ProgressLogger abort(Throwable reason)
Exception.reason - reason for the failureint getCurrentStep()
ProgressLogger setCurrentStep(int currentStep)
currentStep - the current step that was just finishedint getStepCount()
ProgressLogger setStepCount(int stepCount)
stepCount - the expected step count of this loggerboolean getEnabled()
ProgressLogger setEnabled(boolean enabled)
enabled - true if the logger shall output messages and false otherwise (the logger is enabled by default)Copyright © 2019. All rights reserved.