Interface Logger

All Known Implementing Classes:
StandardLogger

public interface Logger
A class used for outputting application messages.

Messages may be written line by line with any log level defined in LogLevel. More verbose messages should generally be written with a higher log level than more important messages. For example, the "debug" log level should be used for log messages useful for basic debugging by an application developer or user with advanced knowledge of the application, while "error" should be used for any messages that may require intervention by any user.

Generated log messages are written to any number of configured LoggerOutputs.

Since:
2.1
  • Method Details

    • log

      void log(LogLevel level, Object... obj)
      Constructs a log message from the given objects and outputs it at the given log level.
      Parameters:
      level - The log level to output this message at
      obj - The objects to construct a log message from, usually strings
    • getLabel

      String getLabel()
      Returns the label used to identify this Logger in log messages.
      Returns:
      The label
      Since:
      2.5
    • trace

      default void trace(Object... obj)
      Logs the given message at LogLevel.TRACE.
      Parameters:
      obj - The objects to construct a log message from, usually strings
    • debug

      default void debug(Object... obj)
      Logs the given message at LogLevel.DEBUG.
      Parameters:
      obj - The objects to construct a log message from, usually strings
    • info

      default void info(Object... obj)
      Logs the given message at LogLevel.INFO.
      Parameters:
      obj - The objects to construct a log message from, usually strings
    • warn

      default void warn(Object... obj)
      Logs the given message at LogLevel.WARN.
      Parameters:
      obj - The objects to construct a log message from, usually strings
    • error

      default void error(Object... obj)
      Logs the given message at LogLevel.ERROR.
      Parameters:
      obj - The objects to construct a log message from, usually strings
    • fatal

      default void fatal(Object... obj)
      Logs the given message at LogLevel.FATAL.
      Parameters:
      obj - The objects to construct a log message from, usually strings
    • debug

      default boolean debug()
      Utility function to check if debugging is enabled.
      Returns:
      true if the current log level is LogLevel.DEBUG or higher
      Since:
      2.3
    • isLogging

      default boolean isLogging(LogLevel level)
      Checks if this Logger prints log messages, taking into account the configured log level and other logger settings.
      Parameters:
      level - The log level to check
      Returns:
      true if this logger prints log messages on the given log level
      Since:
      2.5
      See Also:
    • create

      static Logger create()
      Creates a new logger bound to the calling class.

      This function is equivalent to LoggerUtil.createLogger().

      Returns:
      The new logger instance
      Since:
      2.3