Class CommonFiles.LoggerBridge

  • Enclosing class:
    CommonFiles

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

      Fields 
      Modifier and Type Field Description
      private org.slf4j.Logger delegate  
      private static java.util.Map<java.util.Map.Entry<org.slf4j.Logger,​org.slf4j.event.Level>,​CommonFiles.LoggerBridge> INSTANCES  
      private java.lang.invoke.MethodHandle isLevelEnabled  
      private org.slf4j.event.Level level  
      private java.lang.invoke.MethodHandle log  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      boolean isLevelEnabled()
      Checks if the delegate logger is active for the configured level.
      void log​(java.lang.String format, java.lang.Object... arguments)
      Submits a log event to the delegate logger at the level of this LoggerBridge.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INSTANCES

        private static final java.util.Map<java.util.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 java.lang.invoke.MethodHandle isLevelEnabled
      • log

        private final java.lang.invoke.MethodHandle log
    • Constructor Detail

      • 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 Detail

      • 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​(java.lang.String format,
                        java.lang.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