Package org.djutils.logger
Class CategoryLogger.DelegateLogger
java.lang.Object
org.djutils.logger.CategoryLogger.DelegateLogger
- Enclosing class:
- CategoryLogger
DelegateLogger class that takes care of actually logging the message and/or exception.
Copyright (c) 2003-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights
reserved.
BSD-style license. See DJUTILS License.
- Author:
- Alexander Verbraeck
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDelegateLogger(org.slf4j.Logger slf4jLogger) Create a DelegateLogger with DelegateLogger as the only class to hide from the call stack.protectedDelegateLogger(org.slf4j.Logger slf4jLogger, Class<?> callerBoundary, boolean log) Create a DelegateLogger with a class that indicates what to hide in the call stack. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFormatter(String find, Supplier<String> replaceSupplier) Add a find-replace formatter on the delegate logger for this delegate logger.voidCreate a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.voidCreate a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.voidCreate a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.voidCreate a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.voidCreate a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.voidCreate a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.protected voidCarry out the callback.voidCreate a error log entry that will be output if ERROR is enabled for this DelegateLogger.voidCreate a error log entry that will be output if ERROR is enabled for this DelegateLogger.voidCreate a error log entry that will be output if ERROR is enabled for this DelegateLogger.voidCreate a error log entry that will be output if ERROR is enabled for this DelegateLogger.voidCreate a error log entry that will be output if ERROR is enabled for this DelegateLogger.voidCreate a error log entry that will be output if ERROR is enabled for this DelegateLogger.voidCreate a info log entry that will be output if INFO is enabled for this DelegateLogger.voidCreate a info log entry that will be output if INFO is enabled for this DelegateLogger.voidCreate a info log entry that will be output if INFO is enabled for this DelegateLogger.voidCreate a info log entry that will be output if INFO is enabled for this DelegateLogger.voidCreate a info log entry that will be output if INFO is enabled for this DelegateLogger.voidCreate a info log entry that will be output if INFO is enabled for this DelegateLogger.protected voidmdc()Apply the formatter suppliers to the mdc context.voidremoveFormatter(String find) Remove a find-replace formatter on the delegate logger for this delegate logger.voidsetCallback(Runnable callback) Set the callback.voidCreate a debug log entry that will be output if TRACE is enabled for this DelegateLogger.voidCreate a trace log entry that will be output if TRACE is enabled for this DelegateLogger.voidCreate a trace log entry that will be output if TRACE is enabled for this DelegateLogger.voidCreate a trace log entry that will be output if TRACE is enabled for this DelegateLogger.voidCreate a trace log entry that will be output if TRACE is enabled for this DelegateLogger.voidCreate a trace log entry that will be output if TRACE is enabled for this DelegateLogger.voidCreate a warn log entry that will be output if WARN is enabled for this DelegateLogger.voidCreate a warn log entry that will be output if WARN is enabled for this DelegateLogger.voidCreate a warn log entry that will be output if WARN is enabled for this DelegateLogger.voidCreate a warn log entry that will be output if WARN is enabled for this DelegateLogger.voidCreate a warn log entry that will be output if WARN is enabled for this DelegateLogger.voidCreate a warn log entry that will be output if WARN is enabled for this DelegateLogger.when(boolean condition) The conditional filter that will result in the usage of a DelegateLogger.when(BooleanSupplier supplier) The conditional filter that will result in the usage of a DelegateLogger.
-
Constructor Details
-
DelegateLogger
Create a DelegateLogger with a class that indicates what to hide in the call stack.- Parameters:
slf4jLogger- the logger facade from slf4j, can be null in case no logging is donecallerBoundary- class that defines what to hide in the call stacklog- whether we should log or not (the NO_LOGGER does not log)
-
DelegateLogger
protected DelegateLogger(org.slf4j.Logger slf4jLogger) Create a DelegateLogger with DelegateLogger as the only class to hide from the call stack.- Parameters:
slf4jLogger- the logger facade from slf4j, can be null in case no logging is done
-
-
Method Details
-
when
The conditional filter that will result in the usage of a DelegateLogger.- Parameters:
condition- the condition that should be evaluated- Returns:
- the logger that further processes logging (DelegateLogger)
-
when
The conditional filter that will result in the usage of a DelegateLogger.- Parameters:
supplier- the function evaluating the condition- Returns:
- the logger that further processes logging (DelegateLogger)
-
addFormatter
Add a find-replace formatter on the delegate logger for this delegate logger.- Parameters:
find- the string to find in the patternreplaceSupplier- the supplier for the replacement string
-
removeFormatter
Remove a find-replace formatter on the delegate logger for this delegate logger.- Parameters:
find- the string to find in the pattern
-
mdc
protected void mdc()Apply the formatter suppliers to the mdc context. -
setCallback
Set the callback.- Parameters:
callback- the callback runnable
-
doCallback
protected void doCallback()Carry out the callback. -
trace
Create a debug log entry that will be output if TRACE is enabled for this DelegateLogger.- Parameters:
object- the result of thetoString()method ofobjectwill be logged
-
trace
Create a trace log entry that will be output if TRACE is enabled for this DelegateLogger.- Parameters:
message- the message to log
-
trace
Create a trace log entry that will be output if TRACE is enabled for this DelegateLogger.- Parameters:
message- the message to be logged, where {} entries will be replaced by argumentsarguments- the arguments to substitute for the {} entries in the message string
-
trace
Create a trace log entry that will be output if TRACE is enabled for this DelegateLogger.- Parameters:
throwable- the throwable to log
-
trace
Create a trace log entry that will be output if TRACE is enabled for this DelegateLogger.- Parameters:
throwable- the throwable to logmessage- the message to log
-
trace
Create a trace log entry that will be output if TRACE is enabled for this DelegateLogger.- Parameters:
throwable- the exception to logmessage- the message to log, where {} entries will be replaced by argumentsarguments- the arguments to substitute for the {} entries in the message string
-
debug
Create a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.- Parameters:
object- the result of thetoString()method ofobjectwill be logged
-
debug
Create a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.- Parameters:
message- the message to log
-
debug
Create a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.- Parameters:
message- the message to be logged, where {} entries will be replaced by argumentsarguments- the arguments to substitute for the {} entries in the message string
-
debug
Create a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.- Parameters:
throwable- the throwable to log
-
debug
Create a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.- Parameters:
throwable- the throwable to logmessage- the message to log
-
debug
Create a debug log entry that will be output if DEBUG is enabled for this DelegateLogger.- Parameters:
throwable- the exception to logmessage- the message to log, where {} entries will be replaced by argumentsarguments- the arguments to substitute for the {} entries in the message string
-
info
Create a info log entry that will be output if INFO is enabled for this DelegateLogger.- Parameters:
object- the result of thetoString()method ofobjectwill be logged
-
info
Create a info log entry that will be output if INFO is enabled for this DelegateLogger.- Parameters:
message- the message to log
-
info
Create a info log entry that will be output if INFO is enabled for this DelegateLogger.- Parameters:
message- the message to be logged, where {} entries will be replaced by argumentsarguments- the arguments to substitute for the {} entries in the message string
-
info
Create a info log entry that will be output if INFO is enabled for this DelegateLogger.- Parameters:
throwable- the throwable to log
-
info
Create a info log entry that will be output if INFO is enabled for this DelegateLogger.- Parameters:
throwable- the throwable to logmessage- the message to log
-
info
Create a info log entry that will be output if INFO is enabled for this DelegateLogger.- Parameters:
throwable- the exception to logmessage- the message to log, where {} entries will be replaced by argumentsarguments- the arguments to substitute for the {} entries in the message string
-
warn
Create a warn log entry that will be output if WARN is enabled for this DelegateLogger.- Parameters:
object- the result of thetoString()method ofobjectwill be logged
-
warn
Create a warn log entry that will be output if WARN is enabled for this DelegateLogger.- Parameters:
message- the message to log
-
warn
Create a warn log entry that will be output if WARN is enabled for this DelegateLogger.- Parameters:
message- the message to be logged, where {} entries will be replaced by argumentsarguments- the arguments to substitute for the {} entries in the message string
-
warn
Create a warn log entry that will be output if WARN is enabled for this DelegateLogger.- Parameters:
throwable- the throwable to log
-
warn
Create a warn log entry that will be output if WARN is enabled for this DelegateLogger.- Parameters:
throwable- the throwable to logmessage- the message to log
-
warn
Create a warn log entry that will be output if WARN is enabled for this DelegateLogger.- Parameters:
throwable- the exception to logmessage- the message to log, where {} entries will be replaced by argumentsarguments- the arguments to substitute for the {} entries in the message string
-
error
Create a error log entry that will be output if ERROR is enabled for this DelegateLogger.- Parameters:
object- the result of thetoString()method ofobjectwill be logged
-
error
Create a error log entry that will be output if ERROR is enabled for this DelegateLogger.- Parameters:
message- the message to log
-
error
Create a error log entry that will be output if ERROR is enabled for this DelegateLogger.- Parameters:
message- the message to be logged, where {} entries will be replaced by argumentsarguments- the arguments to substitute for the {} entries in the message string
-
error
Create a error log entry that will be output if ERROR is enabled for this DelegateLogger.- Parameters:
throwable- the throwable to log
-
error
Create a error log entry that will be output if ERROR is enabled for this DelegateLogger.- Parameters:
throwable- the throwable to logmessage- the message to log
-
error
Create a error log entry that will be output if ERROR is enabled for this DelegateLogger.- Parameters:
throwable- the exception to logmessage- the message to log, where {} entries will be replaced by argumentsarguments- the arguments to substitute for the {} entries in the message string
-