Interface Logger

All Known Implementing Classes:
LoggerImpl, NoOpLogger, PlainLogger

public interface Logger
A logger interface for logging messages at different severity levels. Implementations of this interface can be used for logging messages to various destinations such as console, files, databases, etc.
Since:
1.0.0-SNAPSHOT
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a clone of this Logger with a specified name.
    default Logger
    cloneWithName(String format, Object... args)
    Creates a clone of this Logger with a formatted name.
    default void
    debug(@NotNull String format, Object... args)
    Logs a formatted debug message.
    void
    debug(@Nullable String text)
    Logs a debug message.
    default void
    error(@NotNull String format, @NotNull Throwable throwable, Object... args)
    Logs a formatted error message along with the associated throwable.
    default void
    error(@NotNull String format, Object... args)
    Logs a formatted error message.
    void
    error(@NotNull Throwable throwable)
    Logs an error message along with the associated throwable.
    default void
    error(@NotNull Throwable throwable, @Nullable String comment)
    Deprecated, for removal: This API element is subject to removal in a future version.
    void
    error(@Nullable String text)
    Logs an error message.
    void
    error(@Nullable String message, @NotNull Throwable throwable)
    Logs an error message along with the associated throwable.
    default String
    format(@NotNull String format, Object... args)
    Utility method for formatting a string with arguments.
    default void
    info(@NotNull String format, Object... args)
    Logs a formatted informational message.
    void
    info(@Nullable String text)
    Logs an informational message.
    default void
    warning(@NotNull String format, Object... args)
    Logs a formatted warning message.
    void
    warning(@Nullable String text)
    Logs a warning message.
  • Method Details

    • info

      void info(@Nullable @Nullable String text)
      Logs an informational message.
      Parameters:
      text - The text of the informational message to log. It can be null.
    • info

      default void info(@NotNull @NotNull String format, Object... args)
      Logs a formatted informational message.

      This method formats the given string with the specified arguments using format(String, Object...) before logging it.

      Parameters:
      format - The format string. Must not be null.
      args - Arguments referenced by the format specifiers in the format string.
      Since:
      3.5.2
    • warning

      void warning(@Nullable @Nullable String text)
      Logs a warning message.
      Parameters:
      text - The text of the warning message to log. It can be null.
    • warning

      default void warning(@NotNull @NotNull String format, Object... args)
      Logs a formatted warning message.

      This method formats the given string with the specified arguments using format(String, Object...) before logging it.

      Parameters:
      format - The format string. Must not be null.
      args - Arguments referenced by the format specifiers in the format string.
      Since:
      3.5.2
    • error

      void error(@Nullable @Nullable String text)
      Logs an error message.
      Parameters:
      text - The text of the error message to log. It can be null.
    • error

      default void error(@NotNull @NotNull String format, Object... args)
      Logs a formatted error message.

      This method formats the given string with the specified arguments using format(String, Object...) before logging it.

      Parameters:
      format - The format string. Must not be null.
      args - Arguments referenced by the format specifiers in the format string.
      Since:
      3.5.2
    • error

      void error(@NotNull @NotNull Throwable throwable)
      Logs an error message along with the associated throwable.
      Parameters:
      throwable - The Throwable object representing the error. Must not be null.
    • error

      @Deprecated(since="3.5.2", forRemoval=true) default void error(@NotNull @NotNull Throwable throwable, @Nullable @Nullable String comment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Logs an error message along with the associated throwable and additional comment.
      Parameters:
      throwable - The Throwable object representing the error. Must not be null.
      comment - Additional comment or context for the error. It can be null.
    • error

      void error(@Nullable @Nullable String message, @NotNull @NotNull Throwable throwable)
      Logs an error message along with the associated throwable.
      Parameters:
      message - A descriptive message for the error. It can be null.
      throwable - The Throwable object representing the error. Must not be null.
      Since:
      3.5.2
    • error

      default void error(@NotNull @NotNull String format, @NotNull @NotNull Throwable throwable, Object... args)
      Logs a formatted error message along with the associated throwable.

      This method formats the given string with the specified arguments using format(String, Object...) before logging it together with the provided throwable.

      Parameters:
      format - The format string. Must not be null.
      throwable - The Throwable object representing the error. Must not be null.
      args - Arguments referenced by the format specifiers in the format string.
      Since:
      3.5.2
    • debug

      void debug(@Nullable @Nullable String text)
      Logs a debug message.
      Parameters:
      text - The text of the debug message to log. It can be null.
    • debug

      default void debug(@NotNull @NotNull String format, Object... args)
      Logs a formatted debug message.

      This method formats the given string with the specified arguments using format(String, Object...) before logging it.

      Parameters:
      format - The format string. Must not be null.
      args - Arguments referenced by the format specifiers in the format string.
      Since:
      3.5.2
    • cloneWithName

      Logger cloneWithName(String name)
      Creates a clone of this Logger with a specified name.
      Parameters:
      name - The name for the cloned logger.
      Returns:
      A new Logger instance cloned from this logger with the given name.
    • cloneWithName

      default Logger cloneWithName(String format, Object... args)
      Creates a clone of this Logger with a formatted name.

      The provided format string and arguments are combined into a name using format(String, Object...), which is then used to create the cloned logger.

      Parameters:
      format - The format string used for the logger name. Must not be null.
      args - Arguments referenced by the format specifiers in the format string.
      Returns:
      A new Logger instance cloned from this logger with the formatted name.
      Since:
      3.5.2
    • format

      default String format(@NotNull @NotNull String format, Object... args)
      Utility method for formatting a string with arguments.

      This method simply delegates to String.format(String, Object...).

      Parameters:
      format - The format string. Must not be null.
      args - Arguments referenced by the format specifiers in the format string.
      Returns:
      A formatted string.
      Since:
      3.5.2