Package org.terracotta.utilities.test.io
Class CommonFiles.LoggerBridge
java.lang.Object
org.terracotta.utilities.test.io.CommonFiles.LoggerBridge
- Enclosing class:
- CommonFiles
Bridge to permit variable-level use of SLF4j.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.slf4j.Loggerprivate static final Map<Map.Entry<org.slf4j.Logger,org.slf4j.event.Level>, CommonFiles.LoggerBridge> private final MethodHandleprivate final org.slf4j.event.Levelprivate final MethodHandle -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateLoggerBridge(org.slf4j.Logger delegate, org.slf4j.event.Level level) Creates aLoggerBridgeinstance sending logging calls to the designatedLoggerat the specified level. -
Method Summary
Modifier and TypeMethodDescriptionstatic CommonFiles.LoggerBridgegetInstance(org.slf4j.Logger delegate, org.slf4j.event.Level level) Creates or gets theLoggerBridgeinstance for the delegateLoggerandLevel.booleanChecks if the delegate logger is active for the configured level.voidSubmits a log event to the delegate logger at the level of thisLoggerBridge.
-
Field Details
-
INSTANCES
private static final Map<Map.Entry<org.slf4j.Logger,org.slf4j.event.Level>, INSTANCESCommonFiles.LoggerBridge> -
delegate
private final org.slf4j.Logger delegate -
level
private final org.slf4j.event.Level level -
isLevelEnabled
-
log
-
-
Constructor Details
-
LoggerBridge
private LoggerBridge(org.slf4j.Logger delegate, org.slf4j.event.Level level) Creates aLoggerBridgeinstance sending logging calls to the designatedLoggerat the specified level.- Parameters:
delegate- the delegateLoggerlevel- the level at which thelogmethod records
-
-
Method Details
-
getInstance
public static CommonFiles.LoggerBridge getInstance(org.slf4j.Logger delegate, org.slf4j.event.Level level) Creates or gets theLoggerBridgeinstance for the delegateLoggerandLevel.- Parameters:
delegate- theLoggerto which logging calls are delegatedlevel- theLevelat which the returnedLoggingBridgelogs- Returns:
- a
LoggingBridgeinstance
-
isLevelEnabled
public boolean isLevelEnabled()Checks if the delegate logger is active for the configured level.- Returns:
trueif the delegate logger is configured to record events of the level of thisLoggerBridge
-
log
Submits a log event to the delegate logger at the level of thisLoggerBridge. If the virtual call to the log method fails, the log event is recorded at theINFOlevel.- Parameters:
format- the log message formatarguments- the arguments for the message
-