Interface IntentionalLogger
In the base configuration, public interface IntentionalLogger provides a number of utility methods for managing logging messages. The interface methods focus on event types instead of severity levels.
To obtain a new instance of an IntentionalLogger object, use the
following static factory method:
- IntentionalLogger.from(logger)
The IntentionalLogger interface declares a number of
void methods with overloaded method parameters.| Method | Possible parameters | Usage |
|---|---|---|
| logStart(…) | operation, message, params | Logs the start of an operation. |
| logStop(…) | operation, message, params, elapsedTime | Logs the completion of a successful operation. |
| logResult(…) | message, params, elapsedTime | Logs the completion of a successful operation with additional parameters, meaning that the operation completed sucessfully and there is a need to log more information. |
| logFail(…) | message, params, elapsedTime | Logs the completion of a unsuccessful operation. The operation ended because of an unexpected error or for specific business reason. |
| logStatus(…) | message, params | Logs metric-type values, or, status change events that occur in the middle of an operation. |
| logError(…) | message, params, t | Logs an error (of type t) that occurred in the middle of an operation. |
| logDebugEvent(…) | message, params | Logs an event at the DEBUG level. |
Each of these interface methods takes one or more of the following arguments.
| Method argument | Meaning |
|---|---|
| operation | Marker that uniquely identifies an operation. |
| message | Message that describes an event. |
| params | Additional parameters that provide additional logging information. |
| elapsedTime | Time that elapsed between specific start and stop events. |
| t | Error that occurred (of type Throwable). |
Parameter usage
A number of methods on IntentionalLogger take a
LogMessageParams(params) argument. These methods always creates a copy
of the passed-in LogMessageParams argument, which the method never modifies
thereafter. Thus, the method always has access to a clean, unmodified, copy of the original
passed-in params argument.
