Interface Logger


public interface Logger
Main interface for logging. Most operations are done through this interface. This interface is heavily influenced by org.apache.logging.log4j2.Logger. The most notable difference is lack of methods with Marker, LogBuilder and the message supplier is java.util.function.Supplier<String>
  • Method Details

    • log

      void log(Level level, String message)
      Logs a message String with the given level.
      Parameters:
      level - the logging level
      message - the message to log.
    • log

      void log(Level level, Supplier<String> messageSupplier, Throwable throwable)
      Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled for the specified log message level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      level - the logging level
      messageSupplier - A function, which when called, produces the desired log String message;
      throwable - A Throwable associated with the log message.
    • getName

      String getName()
      Gets the logger name.
      Returns:
      the logger name.
    • isFatalEnabled

      boolean isFatalEnabled()
      Checks whether this Logger is enabled for the FATAL Level.
      Returns:
      boolean - true if this Logger is enabled for level FATAL, false otherwise.
    • isErrorEnabled

      boolean isErrorEnabled()
      Checks whether this Logger is enabled for the ERROR Level.
      Returns:
      boolean - true if this Logger is enabled for level ERROR, false otherwise.
    • isWarnEnabled

      boolean isWarnEnabled()
      Checks whether this Logger is enabled for the WARN Level.
      Returns:
      boolean - true if this Logger is enabled for level WARN, false otherwise.
    • isInfoEnabled

      boolean isInfoEnabled()
      Checks whether this Logger is enabled for the INFO Level.
      Returns:
      boolean - true if this Logger is enabled for level INFO, false otherwise.
    • isDebugEnabled

      boolean isDebugEnabled()
      Checks whether this Logger is enabled for the DEBUG Level.
      Returns:
      boolean - true if this Logger is enabled for level DEBUG, false otherwise.
    • isTraceEnabled

      boolean isTraceEnabled()
      Checks whether this Logger is enabled for the TRACE Level.
      Returns:
      boolean - true if this Logger is enabled for level TRACE, false otherwise.
    • isEnabled

      boolean isEnabled(Level level)
      Checks whether this Logger is enabled for the given Level.

      Note that passing in OFF always returns true.

      Parameters:
      level - the Level to check
      Returns:
      boolean - true if this Logger is enabled for level, false otherwise.
    • fatal

      void fatal(Supplier<String> messageSupplier)
      Logs a lazily supplied String message. If the logger is currently enabled for FATAL level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
    • fatal

      void fatal(Supplier<String> messageSupplier, Throwable throwable)
      Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled for FATAL level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
      throwable - A Throwable associated with the log message.
    • fatal

      void fatal(String message)
      Logs a message at the FATAL level.
      Parameters:
      message - the message string to be logged
    • fatal

      void fatal(String message, Throwable throwable)
      Logs a message at the FATAL level.
      Parameters:
      message - the message string to be logged
      throwable - A Throwable associated with the log message.
    • fatal

      void fatal(String message, Object... params)
      Logs a message with parameters at the FATAL level.
      Parameters:
      message - the message to log
      params - parameters to the message.
    • error

      void error(Supplier<String> messageSupplier)
      Logs a lazily supplied String message. If the logger is currently enabled for ERROR level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
    • error

      void error(Supplier<String> messageSupplier, Throwable throwable)
      Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled for ERROR level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
      throwable - A Throwable associated with the log message.
    • error

      void error(String message)
      Logs a message at the ERROR level.
      Parameters:
      message - the message string to be logged
    • error

      void error(String message, Throwable throwable)
      Logs a message at the ERROR level.
      Parameters:
      message - the message string to be logged
      throwable - A Throwable associated with the log message.
    • error

      void error(String message, Object... params)
      Logs a message with parameters at the ERROR level.
      Parameters:
      message - the message to log
      params - parameters to the message.
    • warn

      void warn(Supplier<String> messageSupplier)
      Logs a lazily supplied String message. If the logger is currently enabled for WARN level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
    • warn

      void warn(Supplier<String> messageSupplier, Throwable throwable)
      Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled for WARN level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
      throwable - A Throwable associated with the log message.
    • warn

      void warn(String message)
      Logs a message at the WARN level.
      Parameters:
      message - the message string to be logged
    • warn

      void warn(String message, Throwable throwable)
      Logs a message at the WARN level.
      Parameters:
      message - the message string to be logged
      throwable - A Throwable associated with the log message.
    • warn

      void warn(String message, Object... params)
      Logs a message with parameters at the WARN level.
      Parameters:
      message - the message to log
      params - parameters to the message.
    • info

      void info(Supplier<String> messageSupplier)
      Logs a lazily supplied String message. If the logger is currently enabled for INFO level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
    • info

      void info(Supplier<String> messageSupplier, Throwable throwable)
      Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled for INFO level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
      throwable - A Throwable associated with the log message.
    • info

      void info(String message)
      Logs a message at the INFO level.
      Parameters:
      message - the message string to be logged
    • info

      void info(String message, Throwable throwable)
      Logs a message at the INFO level.
      Parameters:
      message - the message string to be logged
      throwable - A Throwable associated with the log message.
    • info

      void info(String message, Object... params)
      Logs a message with parameters at the INFO level.
      Parameters:
      message - the message to log
      params - parameters to the message.
    • debug

      void debug(Supplier<String> messageSupplier)
      Logs a lazily supplied String message. If the logger is currently enabled for DEBUG level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
    • debug

      void debug(Supplier<String> messageSupplier, Throwable throwable)
      Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled for DEBUG level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
      throwable - A Throwable associated with the log message.
    • debug

      void debug(String message)
      Logs a message at the DEBUG level.
      Parameters:
      message - the message string to be logged
    • debug

      void debug(String message, Throwable throwable)
      Logs a message at the DEBUG level.
      Parameters:
      message - the message string to be logged
      throwable - A Throwable associated with the log message.
    • debug

      void debug(String message, Object... params)
      Logs a message with parameters at the DEBUG level.
      Parameters:
      message - the message to log
      params - parameters to the message.
    • trace

      void trace(Supplier<String> messageSupplier)
      Logs a lazily supplied String message. If the logger is currently enabled for FATAL level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
    • trace

      void trace(Supplier<String> messageSupplier, Throwable throwable)
      Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled for FATAL level, then a message is logged that is the result produced by the given supplier function.
      Parameters:
      messageSupplier - A function, which when called, produces the desired log String message;
      throwable - A Throwable associated with the log message.
    • trace

      void trace(String message)
      Logs a message at the TRACE level.
      Parameters:
      message - the message string to be logged
    • trace

      void trace(String message, Throwable throwable)
      Logs a message at the TRACE level.
      Parameters:
      message - the message string to be logged
      throwable - A Throwable associated with the log message.
    • trace

      void trace(String message, Object... params)
      Logs a message with parameters at the TRACE level.
      Parameters:
      message - the message to log
      params - parameters to the message.