m8ty-logging - m8ty Logging
To be able to log method calls, m8ty offers a corresponding annotation system.
The following annotations are available for this purpose:
@LogMethod
Logs only the method call.
Example output
INFO eu.m8ty.logging.LoggingImpl.logMethodCalled 49 - [m8ty Logging] Method MockKeycloakController.token(..) has been calledContent copied to clipboard
@LogDuration
Logs the method and the time used for it.
Example output
INFO eu.m8ty.logging.LoggingImpl.logExecutionTime 37 - [m8ty Logging] MockKeycloakController.token(..) execution took 72 msContent copied to clipboard
@LogMethodWithParams
Logs the method with parameters. These can still be skipped or obfuscated accordingly.
The following parameters are available to control the parameters:
| Argument | Type | Description |
|---|---|---|
logInput | bool | Switch to activate or deactivate input parameter logging. |
logOutput | bool | Switch to activate or deactivate output parameter logging. |
obfuscateParameters | array | Array of parameter names to obfuscate at input and output logging. |
obfuscateParametersInput | array | Array of parameter names to obfuscate at input logging. |
obfuscateParametersOutput | array | Array of parameter names to obfuscate at output logging. |
skipParameters | array | Array of parameter names to skip for input and output logging. |
skipParametersInput | array | Array of parameter names to skip for input logging. |
skipParametersOutput | array | Array of parameter names to skip for output logging. |
Example output (without arguments)
INFO eu.m8ty.logging.LoggingImpl.logMethodResult 99 - [m8ty Logging] Results for {}:
{} MockKeycloakController.token(..) {
"headers" : { },
"body" : {
"token" : "eyJraWQiOiJrZX...."
},
"statusCodeValue" : 200,
"statusCode" : "OK"
}Content copied to clipboard
Example output (with logOutput=false argument)
INFO eu.m8ty.logging.LoggingImpl.logMethodParams 78 - [m8ty Logging] Input parameter for MockKeycloakController.token(..):[String userId]
"b846f572-6329-4ce3-a788-c005e72cba09";Content copied to clipboard
Example output (with obfuscateParameters = ["token"] argument)
INFO eu.m8ty.logging.LoggingImpl.logMethodResult 99 - [m8ty Logging] Results for {}:
{} MockKeycloakController.token(..) {
"headers" : { },
"body" : {
"token" : "*****"
},
"statusCodeValue" : 200,
"statusCode" : "OK"
}Content copied to clipboard