Class AbstractInternalLogger

java.lang.Object
io.netty.util.internal.logging.AbstractInternalLogger
All Implemented Interfaces:
InternalLogger, java.io.Serializable
Direct Known Subclasses:
CommonsLogger, JdkLogger, LocationAwareSlf4JLogger, Log4JLogger, Slf4JLogger

public abstract class AbstractInternalLogger extends java.lang.Object implements InternalLogger, java.io.Serializable
A skeletal implementation of InternalLogger. This class implements all methods that have a InternalLogLevel parameter by default to call specific logger methods such as InternalLogger.info(String) or InternalLogger.isInfoEnabled().
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final java.lang.String
     
    private final java.lang.String
     
    private static final long
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractInternalLogger(java.lang.String name)
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    debug(java.lang.Throwable t)
    Log an exception (throwable) at the DEBUG level.
    void
    error(java.lang.Throwable t)
    Log an exception (throwable) at the ERROR level.
    void
    info(java.lang.Throwable t)
    Log an exception (throwable) at the INFO level.
    boolean
    Is the logger instance enabled for the specified level?
    void
    log(InternalLogLevel level, java.lang.String msg)
    Log a message at the specified level.
    void
    log(InternalLogLevel level, java.lang.String format, java.lang.Object arg)
    Log a message at the specified level according to the specified format and argument.
    void
    log(InternalLogLevel level, java.lang.String format, java.lang.Object... arguments)
    Log a message at the specified level according to the specified format and arguments.
    void
    log(InternalLogLevel level, java.lang.String format, java.lang.Object argA, java.lang.Object argB)
    Log a message at the specified level according to the specified format and arguments.
    void
    log(InternalLogLevel level, java.lang.String msg, java.lang.Throwable cause)
    Log an exception (throwable) at the specified level with an accompanying message.
    void
    log(InternalLogLevel level, java.lang.Throwable cause)
    Log an exception (throwable) at the specified level.
    java.lang.String
    Return the name of this InternalLogger instance.
    protected java.lang.Object
     
    java.lang.String
     
    void
    trace(java.lang.Throwable t)
    Log an exception (throwable) at the TRACE level.
    void
    warn(java.lang.Throwable t)
    Log an exception (throwable) at the WARN level.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • EXCEPTION_MESSAGE

      static final java.lang.String EXCEPTION_MESSAGE
      See Also:
    • name

      private final java.lang.String name
  • Constructor Details

    • AbstractInternalLogger

      protected AbstractInternalLogger(java.lang.String name)
      Creates a new instance.
  • Method Details

    • name

      public java.lang.String name()
      Description copied from interface: InternalLogger
      Return the name of this InternalLogger instance.
      Specified by:
      name in interface InternalLogger
      Returns:
      name of this logger instance
    • isEnabled

      public boolean isEnabled(InternalLogLevel level)
      Description copied from interface: InternalLogger
      Is the logger instance enabled for the specified level?
      Specified by:
      isEnabled in interface InternalLogger
      Returns:
      True if this Logger is enabled for the specified level, false otherwise.
    • trace

      public void trace(java.lang.Throwable t)
      Description copied from interface: InternalLogger
      Log an exception (throwable) at the TRACE level.
      Specified by:
      trace in interface InternalLogger
      Parameters:
      t - the exception (throwable) to log
    • debug

      public void debug(java.lang.Throwable t)
      Description copied from interface: InternalLogger
      Log an exception (throwable) at the DEBUG level.
      Specified by:
      debug in interface InternalLogger
      Parameters:
      t - the exception (throwable) to log
    • info

      public void info(java.lang.Throwable t)
      Description copied from interface: InternalLogger
      Log an exception (throwable) at the INFO level.
      Specified by:
      info in interface InternalLogger
      Parameters:
      t - the exception (throwable) to log
    • warn

      public void warn(java.lang.Throwable t)
      Description copied from interface: InternalLogger
      Log an exception (throwable) at the WARN level.
      Specified by:
      warn in interface InternalLogger
      Parameters:
      t - the exception (throwable) to log
    • error

      public void error(java.lang.Throwable t)
      Description copied from interface: InternalLogger
      Log an exception (throwable) at the ERROR level.
      Specified by:
      error in interface InternalLogger
      Parameters:
      t - the exception (throwable) to log
    • log

      public void log(InternalLogLevel level, java.lang.String msg, java.lang.Throwable cause)
      Description copied from interface: InternalLogger
      Log an exception (throwable) at the specified level with an accompanying message.
      Specified by:
      log in interface InternalLogger
      Parameters:
      msg - the message accompanying the exception
      cause - the exception (throwable) to log
    • log

      public void log(InternalLogLevel level, java.lang.Throwable cause)
      Description copied from interface: InternalLogger
      Log an exception (throwable) at the specified level.
      Specified by:
      log in interface InternalLogger
      Parameters:
      cause - the exception (throwable) to log
    • log

      public void log(InternalLogLevel level, java.lang.String msg)
      Description copied from interface: InternalLogger
      Log a message at the specified level.
      Specified by:
      log in interface InternalLogger
      Parameters:
      msg - the message string to be logged
    • log

      public void log(InternalLogLevel level, java.lang.String format, java.lang.Object arg)
      Description copied from interface: InternalLogger
      Log a message at the specified level according to the specified format and argument.

      This form avoids superfluous object creation when the logger is disabled for the specified level.

      Specified by:
      log in interface InternalLogger
      Parameters:
      format - the format string
      arg - the argument
    • log

      public void log(InternalLogLevel level, java.lang.String format, java.lang.Object argA, java.lang.Object argB)
      Description copied from interface: InternalLogger
      Log a message at the specified level according to the specified format and arguments.

      This form avoids superfluous object creation when the logger is disabled for the specified level.

      Specified by:
      log in interface InternalLogger
      Parameters:
      format - the format string
      argA - the first argument
      argB - the second argument
    • log

      public void log(InternalLogLevel level, java.lang.String format, java.lang.Object... arguments)
      Description copied from interface: InternalLogger
      Log a message at the specified level according to the specified format and arguments.

      This form avoids superfluous string concatenation when the logger is disabled for the specified level. However, this variant incurs the hidden (and relatively small) cost of creating an Object[] before invoking the method, even if this logger is disabled for the specified level. The variants taking one and two arguments exist solely in order to avoid this hidden cost.

      Specified by:
      log in interface InternalLogger
      Parameters:
      format - the format string
      arguments - a list of 3 or more arguments
    • readResolve

      protected java.lang.Object readResolve() throws java.io.ObjectStreamException
      Throws:
      java.io.ObjectStreamException
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object