public class LoggingCallback extends CallbackSkeleton
Callback.Event
Constructor and Description |
---|
LoggingCallback()
Default constructor logging everything to SLF4J.
|
LoggingCallback(LogTemplate<Split> stopwatchLogTemplate,
LogTemplate<String> managerLogTemplate)
Constructor which can be used to customize log templates.
|
Modifier and Type | Method and Description |
---|---|
LogTemplate<String> |
getManagerLogTemplate()
Get log template used for manage warnings.
|
LogTemplate<Split> |
getStopwatchLogTemplate()
Get log template used for stopwatch splits.
|
protected LogTemplate<Split> |
getStopwatchLogTemplate(Stopwatch stopwatch)
Get log template for stopwatch, defaults to
stopwatchLogTemplate . |
void |
onManagerWarning(String warning,
Exception cause)
Warning event containing warning and/or cause.
|
void |
onStopwatchStop(Split split,
StopwatchSample sample)
Stopwatch stop event.
|
cleanup, initialize, onCounterDecrease, onCounterIncrease, onCounterSet, onManagerClear, onManagerMessage, onSimonCreated, onSimonDestroyed, onStopwatchAdd, onStopwatchStart
public LoggingCallback(LogTemplate<Split> stopwatchLogTemplate, LogTemplate<String> managerLogTemplate)
stopwatchLogTemplate
- Logger used for Stopwatch splitsmanagerLogTemplate
- Logger used for managerpublic LoggingCallback()
public LogTemplate<String> getManagerLogTemplate()
public LogTemplate<Split> getStopwatchLogTemplate()
protected LogTemplate<Split> getStopwatchLogTemplate(Stopwatch stopwatch)
stopwatchLogTemplate
.
This method can be overridden to get a specific log template per stopwatch.stopwatch
- Stopwatchpublic void onStopwatchStop(Split split, StopwatchSample sample)
StopwatchSample
valid for the moment after the stop is provided
because the callback is executed out of synchronized block.
It is guaranteed that Split.getStopwatch()
will not return null
.
Split and stopwatch are logger to log template is enabled.onStopwatchStop
in interface Callback
onStopwatchStop
in class CallbackSkeleton
split
- Splitsample
- Stopwatch samplepublic void onManagerWarning(String warning, Exception cause)
Callback
onManagerWarning
in interface Callback
onManagerWarning
in class CallbackSkeleton
warning
- arbitrary warning message - can be null
, unless concrete implementation states otherwisecause
- exception causing this warning - can be null
, unless concrete implementation states otherwiseCopyright © 2019. All rights reserved.