java.lang.Object
com.renomad.minum.logging.Logger
- All Implemented Interfaces:
ILogger
- Direct Known Subclasses:
TestLogger
Implementation of
ILogger-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AbstractActionQueueTheLoggingActionQueuethat handles all our messages thread-safely by taking them off the top of a queue. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method can be used to adjust the active log levels, which is a mapping of keys ofLoggingLevelto boolean values.voidLogs helpful debugging information inside threadsvoidThis is for logging business-related topicsvoidLogs helpful debugging informationvoidLogs helpful debugging informationvoidstop()When we are shutting down the system it is necessary to explicitly stop the logger.
-
Field Details
-
loggingActionQueue
TheLoggingActionQueuethat 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 aLoggingActionQueuename- sets a name on theLoggingActionQueueto 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:ILoggerLogs helpful debugging information -
logTrace
Description copied from interface:ILoggerLogs 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:ILoggerThis 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:ILoggerWhen 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:ILoggerLogs helpful debugging information inside threads- Specified by:
logAsyncErrorin interfaceILogger- Parameters:
msg- a lambda for what is to be logged. example: () -> "Hello"
-
getActiveLogLevels
Description copied from interface:ILoggerThis method can be used to adjust the active log levels, which is a mapping of keys ofLoggingLevelto boolean values. If the boolean value is true, that level of logging is enabled.- Specified by:
getActiveLogLevelsin interfaceILogger
-