Class DefaultLogging

java.lang.Object
org.seppiko.commons.logging.event.DefaultLogging
All Implemented Interfaces:
Logging

public class DefaultLogging extends Object implements Logging
Default logging implementation
Author:
Leonard Woo
  • Field Details

    • DEFAULT_DATE_TIME_FORMAT

      protected static final String DEFAULT_DATE_TIME_FORMAT
      The default format to use when formatting dates
      See Also:
    • currentLogLevel

      protected volatile int currentLogLevel
      current log level.
  • Constructor Details

    • DefaultLogging

      public DefaultLogging()
      Default constructor
    • DefaultLogging

      public DefaultLogging(String loggingName)
      constructor with logging name
      Parameters:
      loggingName - logging name.
  • Method Details

    • setDelegate

      public void setDelegate(Logging logging)
      set delegate logging
      Parameters:
      logging - delegate logging.
    • getName

      public String getName()
      Get logging name
      Specified by:
      getName in interface Logging
      Returns:
      logging name.
    • isEnable

      public boolean isEnable(int level)
      Checks whether this Logger is enabled for the given Level.
      Specified by:
      isEnable in interface Logging
      Parameters:
      level - the Level to check.
      Returns:
      boolean - true if this Logger is enabled for level, false otherwise.
    • log

      public void log(int level, CharSequence message)
      Logs a message with the specific Marker at the given level.
      Specified by:
      log in interface Logging
      Parameters:
      level - the logging level.
      message - the message string to be logged.
    • log

      public void log(int level, CharSequence message, Throwable cause)
      Logs a message with the specific Marker at the given level.
      Specified by:
      log in interface Logging
      Parameters:
      level - the logging level.
      message - the message string to be logged.
      cause - A Throwable or 'null'.
    • log

      public void log(int level, CharSequence message, Throwable cause, Supplier<?>... paramSuppliers)
      Logs a message with the specific Marker at the given level.
      Specified by:
      log in interface Logging
      Parameters:
      level - the logging level.
      message - the message string to be logged.
      cause - a Throwable or 'null'.
      paramSuppliers - the parameter Supplier or 'null' to be logged.
    • log

      public void log(int level, CharSequence message, Throwable cause, Object... params)
      Logs a message with the specific Marker at the given level.
      Specified by:
      log in interface Logging
      Parameters:
      level - the logging level.
      message - the message string to be logged.
      cause - a Throwable or 'null'.
      params - the parameter objects or 'null' to be logged.
    • isTraceEnable

      public boolean isTraceEnable()
      Checks whether this Logger is enabled for the TRACE level.
      Specified by:
      isTraceEnable in interface Logging
      Returns:
      true if this Logger is enabled for level TRACE, false otherwise.
    • trace

      public void trace(CharSequence message)
      Logs a message with the TRACE level.
      Specified by:
      trace in interface Logging
      Parameters:
      message - the message object to log.
    • trace

      public void trace(CharSequence message, Throwable cause)
      Logs a message at the TRACE level including the stack trace of the Throwable.
      Specified by:
      trace in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
    • trace

      public void trace(CharSequence message, Throwable cause, Supplier<?>... paramsSupplier)
      Logs a message at the TRACE level with parameters, including the stack trace of the Throwable.
      Specified by:
      trace in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
      paramsSupplier - the parameters to log.
    • atTrace

      public LoggingBuilder atTrace()
      Level TRACE
      Specified by:
      atTrace in interface Logging
      Returns:
      a new LoggingBuilder instance as appropriate for this log.
    • isDebugEnable

      public boolean isDebugEnable()
      Checks whether this Logger is enabled for the DEBUG level.
      Specified by:
      isDebugEnable in interface Logging
      Returns:
      true if this Logger is enabled for level DEBUG, false otherwise.
    • debug

      public void debug(CharSequence message)
      Logs a message with the DEBUG level.
      Specified by:
      debug in interface Logging
      Parameters:
      message - the message object to log.
    • debug

      public void debug(CharSequence message, Throwable cause)
      Logs a message at the DEBUG level including the stack trace of the Throwable.
      Specified by:
      debug in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
    • debug

      public void debug(CharSequence message, Throwable cause, Supplier<?>... paramsSupplier)
      Logs a message at the DEBUG level with parameters, including the stack trace of the Throwable.
      Specified by:
      debug in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
      paramsSupplier - the parameters to log.
    • atDebug

      public LoggingBuilder atDebug()
      Level DEBUG
      Specified by:
      atDebug in interface Logging
      Returns:
      a new LoggingBuilder instance as appropriate for this log.
    • isInfoEnable

      public boolean isInfoEnable()
      Checks whether this Logger is enabled for the INFO level.
      Specified by:
      isInfoEnable in interface Logging
      Returns:
      true if this Logger is enabled for level INFO, false otherwise.
    • info

      public void info(CharSequence message)
      Logs a message with the INFO level.
      Specified by:
      info in interface Logging
      Parameters:
      message - the message object to log.
    • info

      public void info(CharSequence message, Throwable cause)
      Logs a message at the INFO level including the stack trace of the Throwable. throwable passed as parameter.
      Specified by:
      info in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
    • info

      public void info(CharSequence message, Throwable cause, Supplier<?>... paramsSupplier)
      Logs a message at the INFO level with parameters, including the stack trace of the Throwable.
      Specified by:
      info in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
      paramsSupplier - the parameters to log.
    • atInfo

      public LoggingBuilder atInfo()
      Level INFO
      Specified by:
      atInfo in interface Logging
      Returns:
      a new LoggingBuilder instance as appropriate for this log.
    • isWarnEnable

      public boolean isWarnEnable()
      Checks whether this Logger is enabled for the WARN level.
      Specified by:
      isWarnEnable in interface Logging
      Returns:
      true if this Logger is enabled for level WARN, false otherwise.
    • warn

      public void warn(CharSequence message)
      Logs a message with the WARN level.
      Specified by:
      warn in interface Logging
      Parameters:
      message - the message object to log.
    • warn

      public void warn(CharSequence message, Throwable cause)
      Logs a message at the WARN level including the stack trace of the Throwable. throwable passed as parameter.
      Specified by:
      warn in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
    • warn

      public void warn(CharSequence message, Throwable cause, Supplier<?>... paramsSupplier)
      Logs a message at the WARN level with parameters, including the stack trace of the Throwable.
      Specified by:
      warn in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
      paramsSupplier - the parameters to log.
    • atWarn

      public LoggingBuilder atWarn()
      Level WARN
      Specified by:
      atWarn in interface Logging
      Returns:
      a new LoggingBuilder instance as appropriate for this log.
    • isErrorEnable

      public boolean isErrorEnable()
      Checks whether this Logger is enabled for the ERROR level.
      Specified by:
      isErrorEnable in interface Logging
      Returns:
      true if this Logger is enabled for level ERROR, false otherwise.
    • error

      public void error(CharSequence message)
      Logs a message with the ERROR level.
      Specified by:
      error in interface Logging
      Parameters:
      message - the message object to log.
    • error

      public void error(CharSequence message, Throwable cause)
      Logs a message at the ERROR level including the stack trace of the Throwable. throwable passed as parameter.
      Specified by:
      error in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
    • error

      public void error(CharSequence message, Throwable cause, Supplier<?>... paramsSupplier)
      Logs a message at the ERROR level with parameters, including the stack trace of the Throwable.
      Specified by:
      error in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
      paramsSupplier - the parameters to log.
    • atError

      public LoggingBuilder atError()
      Level ERROR
      Specified by:
      atError in interface Logging
      Returns:
      a new LoggingBuilder instance as appropriate for this log.
    • isFatalEnable

      public boolean isFatalEnable()
      Checks whether this Logger is enabled for the FATAL level.
      Specified by:
      isFatalEnable in interface Logging
      Returns:
      true if this Logger is enabled for level FATAL, false otherwise.
    • fatal

      public void fatal(CharSequence message)
      Logs a message with the FATAL level.
      Specified by:
      fatal in interface Logging
      Parameters:
      message - the message object to log.
    • fatal

      public void fatal(CharSequence message, Throwable cause)
      Logs a message at the FATAL level including the stack trace of the Throwable. throwable passed as parameter.
      Specified by:
      fatal in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
    • fatal

      public void fatal(CharSequence message, Throwable cause, Supplier<?>... paramsSupplier)
      Logs a message at the FATAL level with parameters, including the stack trace of the Throwable.
      Specified by:
      fatal in interface Logging
      Parameters:
      message - the message object to log.
      cause - the Throwable to log, including its stack trace.
      paramsSupplier - the parameters to log.
    • atFatal

      public LoggingBuilder atFatal()
      Level FATAL
      Specified by:
      atFatal in interface Logging
      Returns:
      a new LoggingBuilder instance as appropriate for this log.