Class CommonFiles.LoggerBridge

java.lang.Object
org.terracotta.utilities.test.io.CommonFiles.LoggerBridge
Enclosing class:
CommonFiles

private static final class CommonFiles.LoggerBridge extends Object
Bridge to permit variable-level use of SLF4j.
  • Field Details

    • INSTANCES

      private static final Map<Map.Entry<org.slf4j.Logger,org.slf4j.event.Level>,CommonFiles.LoggerBridge> INSTANCES
    • delegate

      private final org.slf4j.Logger delegate
    • level

      private final org.slf4j.event.Level level
    • isLevelEnabled

      private final MethodHandle isLevelEnabled
    • log

      private final MethodHandle log
  • Constructor Details

    • LoggerBridge

      private LoggerBridge(org.slf4j.Logger delegate, org.slf4j.event.Level level)
      Creates a LoggerBridge instance sending logging calls to the designated Logger at the specified level.
      Parameters:
      delegate - the delegate Logger
      level - the level at which the log method records
  • Method Details

    • getInstance

      public static CommonFiles.LoggerBridge getInstance(org.slf4j.Logger delegate, org.slf4j.event.Level level)
      Creates or gets the LoggerBridge instance for the delegate Logger and Level.
      Parameters:
      delegate - the Logger to which logging calls are delegated
      level - the Level at which the returned LoggingBridge logs
      Returns:
      a LoggingBridge instance
    • isLevelEnabled

      public boolean isLevelEnabled()
      Checks if the delegate logger is active for the configured level.
      Returns:
      true if the delegate logger is configured to record events of the level of this LoggerBridge
    • log

      public void log(String format, Object... arguments)
      Submits a log event to the delegate logger at the level of this LoggerBridge. If the virtual call to the log method fails, the log event is recorded at the INFO level.
      Parameters:
      format - the log message format
      arguments - the arguments for the message