Class LoggerAdapterAbstract

  • All Implemented Interfaces:
    ILogger
    Direct Known Subclasses:
    LoggerAdapterConsole, LoggerAdapterDefault, LoggerAdapterJava

    public abstract class LoggerAdapterAbstract
    extends java.lang.Object
    implements ILogger
    Abstract base adapter which contains a convenience class for formatting log4j2-style messages and also routes all level-specific overloads to calls to log, which can simplify some implementations.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  LoggerAdapterAbstract.FormattedMessage
      This is a very naive implementation of log4j2's ParameterizedMessage which is less efficient and less defensive because it doesn't need to handle all the cases that the log4j2 formatter does.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected LoggerAdapterAbstract​(java.lang.String id)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void catching​(java.lang.Throwable t)
      Logs an exception or error that has been caught.
      void debug​(java.lang.String message, java.lang.Object... params)
      Logs a message with parameters at the DEBUG level.
      void debug​(java.lang.String message, java.lang.Throwable t)
      Logs a message at the DEBUG level including the stack trace of the Throwable t passed as parameter.
      void error​(java.lang.String message, java.lang.Object... params)
      Logs a message with parameters at the ERROR level
      void error​(java.lang.String message, java.lang.Throwable t)
      Logs a message at the ERROR level including the stack trace of the Throwable t passed as parameter.
      void fatal​(java.lang.String message, java.lang.Object... params)
      Logs a message with parameters at the FATAL level.
      void fatal​(java.lang.String message, java.lang.Throwable t)
      Logs a message at the FATAL level including the stack trace of the Throwable t passed as parameter.
      java.lang.String getId()
      Get the id of this logger
      void info​(java.lang.String message, java.lang.Object... params)
      Logs a message with parameters at the INFO level.
      void info​(java.lang.String message, java.lang.Throwable t)
      Logs a message at the INFO level including the stack trace of the Throwable t passed as parameter.
      void trace​(java.lang.String message, java.lang.Object... params)
      Logs a message with parameters at the TRACE level.
      void trace​(java.lang.String message, java.lang.Throwable t)
      Logs a message at the TRACE level including the stack trace of the Throwable t passed as parameter.
      void warn​(java.lang.String message, java.lang.Object... params)
      Logs a message with parameters at the WARN level.
      void warn​(java.lang.String message, java.lang.Throwable t)
      Logs a message at the WARN level including the stack trace of the Throwable t passed as parameter.
      • Methods inherited from class java.lang.Object

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

      • LoggerAdapterAbstract

        protected LoggerAdapterAbstract​(java.lang.String id)
        Parameters:
        id - Logger id
    • Method Detail

      • getId

        public java.lang.String getId()
        Get the id of this logger
        Specified by:
        getId in interface ILogger
      • catching

        public void catching​(java.lang.Throwable t)
        Description copied from interface: ILogger
        Logs an exception or error that has been caught.
        Specified by:
        catching in interface ILogger
        Parameters:
        t - The Throwable.
      • debug

        public void debug​(java.lang.String message,
                          java.lang.Object... params)
        Description copied from interface: ILogger
        Logs a message with parameters at the DEBUG level.
        Specified by:
        debug in interface ILogger
        Parameters:
        message - the message to log
        params - parameters to the message
      • debug

        public void debug​(java.lang.String message,
                          java.lang.Throwable t)
        Description copied from interface: ILogger
        Logs a message at the DEBUG level including the stack trace of the Throwable t passed as parameter.
        Specified by:
        debug in interface ILogger
        Parameters:
        message - the message to log
        t - the exception to log, including its stack trace
      • error

        public void error​(java.lang.String message,
                          java.lang.Object... params)
        Description copied from interface: ILogger
        Logs a message with parameters at the ERROR level
        Specified by:
        error in interface ILogger
        Parameters:
        message - the message to log
        params - parameters to the message
      • error

        public void error​(java.lang.String message,
                          java.lang.Throwable t)
        Description copied from interface: ILogger
        Logs a message at the ERROR level including the stack trace of the Throwable t passed as parameter.
        Specified by:
        error in interface ILogger
        Parameters:
        message - the message object to log
        t - the exception to log, including its stack trace
      • fatal

        public void fatal​(java.lang.String message,
                          java.lang.Object... params)
        Description copied from interface: ILogger
        Logs a message with parameters at the FATAL level.
        Specified by:
        fatal in interface ILogger
        Parameters:
        message - the message to log
        params - parameters to the message
      • fatal

        public void fatal​(java.lang.String message,
                          java.lang.Throwable t)
        Description copied from interface: ILogger
        Logs a message at the FATAL level including the stack trace of the Throwable t passed as parameter.
        Specified by:
        fatal in interface ILogger
        Parameters:
        message - the message object to log
        t - the exception to log, including its stack trace
      • info

        public void info​(java.lang.String message,
                         java.lang.Object... params)
        Description copied from interface: ILogger
        Logs a message with parameters at the INFO level.
        Specified by:
        info in interface ILogger
        Parameters:
        message - the message to log
        params - parameters to the message
      • info

        public void info​(java.lang.String message,
                         java.lang.Throwable t)
        Description copied from interface: ILogger
        Logs a message at the INFO level including the stack trace of the Throwable t passed as parameter.
        Specified by:
        info in interface ILogger
        Parameters:
        message - the message object to log
        t - the exception to log, including its stack trace
      • trace

        public void trace​(java.lang.String message,
                          java.lang.Object... params)
        Description copied from interface: ILogger
        Logs a message with parameters at the TRACE level.
        Specified by:
        trace in interface ILogger
        Parameters:
        message - the message to log
        params - parameters to the message
      • trace

        public void trace​(java.lang.String message,
                          java.lang.Throwable t)
        Description copied from interface: ILogger
        Logs a message at the TRACE level including the stack trace of the Throwable t passed as parameter.
        Specified by:
        trace in interface ILogger
        Parameters:
        message - the message object to log
        t - the exception to log, including its stack trace
      • warn

        public void warn​(java.lang.String message,
                         java.lang.Object... params)
        Description copied from interface: ILogger
        Logs a message with parameters at the WARN level.
        Specified by:
        warn in interface ILogger
        Parameters:
        message - the message to log
        params - parameters to the message
      • warn

        public void warn​(java.lang.String message,
                         java.lang.Throwable t)
        Description copied from interface: ILogger
        Logs a message at the WARN level including the stack trace of the Throwable t passed as parameter.
        Specified by:
        warn in interface ILogger
        Parameters:
        message - the message object to log
        t - the exception to log, including its stack trace