java.lang.Object
com.renomad.minum.logging.Logger
- All Implemented Interfaces:
ILogger
- Direct Known Subclasses:
TestLogger
Implementation of
ILogger
-
Field Summary
Modifier and TypeFieldDescriptionprotected final AbstractActionQueue
TheLoggingActionQueue
that handles all our messages thread-safely by taking them off the top of a queue. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThis method can be used to adjust the active log levels, which is a mapping of keys ofLoggingLevel
to boolean values.void
Logs helpful debugging information inside threadsvoid
This is for logging business-related topicsvoid
Logs helpful debugging informationvoid
Logs helpful debugging informationvoid
stop()
When we are shutting down the system it is necessary to explicitly stop the logger.
-
Field Details
-
loggingActionQueue
TheLoggingActionQueue
that handles all our messages thread-safely by taking them off the top of a queue.
-
-
Constructor Details
-
Logger
Constructor- Parameters:
constants
- used for determining enabled log levelsexecutorService
- provides thread handling for the logs, used to build aLoggingActionQueue
name
- sets a name on theLoggingActionQueue
to aid debugging, to help distinguish queues.
-
Logger
A constructor meant for use by descendant classes- Parameters:
logger
- an existing instance of a running logger, needed in order to have the descendant logger using the sameAbstractActionQueue
, which is necessary so logs don't interleave with each other.
-
-
Method Details
-
logDebug
Description copied from interface:ILogger
Logs helpful debugging information -
logTrace
Description copied from interface:ILogger
Logs helpful debugging informationSimilar to
ILogger.logDebug(ThrowingSupplier)
but used for code that runs very often, requires extra calculation, or has data of large size.It is possible to disable trace logs and thus avoid performance impacts unless the data is needed for deeper investigation.
-
logAudit
Description copied from interface:ILogger
This is for logging business-related topicsThis log type is expected to be printed least-often, and should directly relate to a user action. An example would be "New user created: alice"
msg a lambda for what is to be logged. example: () -> "Hello" -
stop
public void stop()Description copied from interface:ILogger
When we are shutting down the system it is necessary to explicitly stop the logger.The logger has to stand apart from the rest of the system, or else we'll have circular dependencies.
-
logAsyncError
Description copied from interface:ILogger
Logs helpful debugging information inside threads- Specified by:
logAsyncError
in interfaceILogger
- Parameters:
msg
- a lambda for what is to be logged. example: () -> "Hello"
-
getActiveLogLevels
Description copied from interface:ILogger
This method can be used to adjust the active log levels, which is a mapping of keys ofLoggingLevel
to boolean values. If the boolean value is true, that level of logging is enabled.- Specified by:
getActiveLogLevels
in interfaceILogger
-