Interface Logger

All Known Implementing Classes:
JdkLogger, Slf4jLogger

public interface Logger
Unified logger. Pay attention that the format follows standard Formatter.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Error message for providing null logger.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    debug(Object format, Object... arguments)
    Logs a message at the DEBUG level according to the specified format and arguments.
    void
    debug(Object message, Throwable t)
    Logs an error (see Throwable) at the DEBUG level with an accompanying message.
    void
    debug(Supplier<?> function)
    Logs output of a custom function at the DEBUG level.
    void
    error(Object format, Object... arguments)
    Logs a message at the ERROR level according to the specified format and arguments.
    void
    error(Object message, Throwable t)
    Logs an error (see Throwable) at the ERROR level with an accompanying message.
    void
    error(Supplier<?> function)
    Logs output of a custom function at the ERROR level.
    void
    info(Object format, Object... arguments)
    Logs a message at the INFO level according to the specified format and arguments.
    void
    info(Object message, Throwable t)
    Logs an error (see Throwable) at the INFO level with an accompanying message.
    void
    info(Supplier<?> function)
    Logs output of a custom function at the INFO level.
    boolean
    Checks if logging level is DEBUG or above.
    boolean
    Checks if logging level is ERROR or above.
    boolean
    Checks if logging level is INFO or above.
    boolean
    Checks if logging level is TRACE or above.
    boolean
    Checks if logging level is WARN or above.
    void
    trace(Object format, Object... arguments)
    Logs a message at the TRACE level according to the specified format and arguments.
    void
    trace(Object message, Throwable t)
    Logs an error (see Throwable) at the TRACE level with an accompanying message.
    void
    trace(Supplier<?> function)
    Logs output of a custom function at the TRACE level.
    Return logger implementation.
    void
    warn(Object format, Object... arguments)
    Logs a message at the WARN level according to the specified format and arguments.
    void
    warn(Object message, Throwable t)
    Logs an error (see Throwable) at the WRAN level with an accompanying message.
    void
    warn(Supplier<?> function)
    Logs output of a custom function at the WARN level.
  • Field Details

  • Method Details

    • isDebugEnabled

      boolean isDebugEnabled()
      Checks if logging level is DEBUG or above.
      Returns:
      true if DEBUG level is enabled; false otherwise
    • isErrorEnabled

      boolean isErrorEnabled()
      Checks if logging level is ERROR or above.
      Returns:
      true if ERROR level is enabled; false otherwise
    • isInfoEnabled

      boolean isInfoEnabled()
      Checks if logging level is INFO or above.
      Returns:
      true if INFO level is enabled; false otherwise
    • isWarnEnabled

      boolean isWarnEnabled()
      Checks if logging level is WARN or above.
      Returns:
      true if WARN level is enabled; false otherwise
    • isTraceEnabled

      boolean isTraceEnabled()
      Checks if logging level is TRACE or above.
      Returns:
      true if TRACE level is enabled; false otherwise
    • debug

      void debug(Supplier<?> function)
      Logs output of a custom function at the DEBUG level. The function will only run when log level is DEBUG or lower.
      Parameters:
      function - custom function to run
    • debug

      void debug(Object format, Object... arguments)
      Logs a message at the DEBUG level according to the specified format and arguments.
      Parameters:
      format - the format string
      arguments - a list of arguments, the last one could be a Throwable
    • debug

      void debug(Object message, Throwable t)
      Logs an error (see Throwable) at the DEBUG level with an accompanying message.
      Parameters:
      message - the message accompanying the error
      t - the error to log
    • error

      void error(Supplier<?> function)
      Logs output of a custom function at the ERROR level. The function will only run when log level is ERROR or lower.
      Parameters:
      function - custom function to run
    • error

      void error(Object format, Object... arguments)
      Logs a message at the ERROR level according to the specified format and arguments.
      Parameters:
      format - the format string
      arguments - a list of arguments, the last one could be a Throwable
    • error

      void error(Object message, Throwable t)
      Logs an error (see Throwable) at the ERROR level with an accompanying message.
      Parameters:
      message - the message accompanying the error
      t - the error to log
    • info

      void info(Supplier<?> function)
      Logs output of a custom function at the INFO level. The function will only run when log level is INFO or lower.
      Parameters:
      function - custom function to run
    • info

      void info(Object format, Object... arguments)
      Logs a message at the INFO level according to the specified format and arguments.
      Parameters:
      format - the format string
      arguments - a list of arguments, the last one could be a Throwable
    • info

      void info(Object message, Throwable t)
      Logs an error (see Throwable) at the INFO level with an accompanying message.
      Parameters:
      message - the message accompanying the error
      t - the error to log
    • trace

      void trace(Supplier<?> function)
      Logs output of a custom function at the TRACE level. The function will only run when log level is TRACE.
      Parameters:
      function - custom function to run
    • trace

      void trace(Object format, Object... arguments)
      Logs a message at the TRACE level according to the specified format and arguments.
      Parameters:
      format - the format string
      arguments - a list of arguments, the last one could be a Throwable
    • trace

      void trace(Object message, Throwable t)
      Logs an error (see Throwable) at the TRACE level with an accompanying message.
      Parameters:
      message - the message accompanying the error
      t - the error to log
    • warn

      void warn(Supplier<?> function)
      Logs output of a custom function at the WARN level. The function will only run when log level is WARN or lower.
      Parameters:
      function - custom function to run
    • warn

      void warn(Object format, Object... arguments)
      Logs a message at the WARN level according to the specified format and arguments.
      Parameters:
      format - the format string
      arguments - a list of arguments, the last one could be a Throwable
    • warn

      void warn(Object message, Throwable t)
      Logs an error (see Throwable) at the WRAN level with an accompanying message.
      Parameters:
      message - the message accompanying the error
      t - the error to log
    • unwrap

      Object unwrap()
      Return logger implementation.
      Returns:
      implementation