Class AbstractLoggerAdapter<L>

    • Field Detail

      • registry

        protected final java.util.Map<LoggerContext,​java.util.concurrent.ConcurrentMap<java.lang.String,​L>> registry
        A map to store loggers for their given LoggerContexts.
      • lock

        private final java.util.concurrent.locks.ReadWriteLock lock
    • Constructor Detail

      • AbstractLoggerAdapter

        public AbstractLoggerAdapter()
    • Method Detail

      • getLogger

        public L getLogger​(java.lang.String name)
        Description copied from interface: LoggerAdapter
        Gets a named logger. Implementations should defer to the abstract methods in AbstractLoggerAdapter.
        Specified by:
        getLogger in interface LoggerAdapter<L>
        Parameters:
        name - the name of the logger to get
        Returns:
        the named logger
      • getLoggersInContext

        public java.util.concurrent.ConcurrentMap<java.lang.String,​L> getLoggersInContext​(LoggerContext context)
        Gets or creates the ConcurrentMap of named loggers for a given LoggerContext.
        Parameters:
        context - the LoggerContext to get loggers for
        Returns:
        the map of loggers for the given LoggerContext
      • getLoggerContexts

        public java.util.Set<LoggerContext> getLoggerContexts()
        For unit testing. Consider to be private.
      • newLogger

        protected abstract L newLogger​(java.lang.String name,
                                       LoggerContext context)
        Creates a new named logger for a given LoggerContext.
        Parameters:
        name - the name of the logger to create
        context - the LoggerContext this logger will be associated with
        Returns:
        the new named logger
      • getContext

        protected LoggerContext getContext​(java.lang.Class<?> callerClass)
        Gets the LoggerContext associated with the given caller class.
        Parameters:
        callerClass - the caller class
        Returns:
        the LoggerContext for the calling class
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable