Package elf4j

Interface Logger

All Known Implementing Classes:
NoopLogger

public interface Logger
All Logger instances from this API should be immutable.
  • Method Details

    • instance

      static Logger instance()
      Returns:
      Logger instance with default name and Level
    • instance

      static Logger instance(String name)
      Parameters:
      name - suggested name of the Logger instance
      Returns:
      Logger instance with the suggested name
    • instance

      static Logger instance(Class<?> clazz)
      Parameters:
      clazz - Class used to suggest the Logger name
      Returns:
      Logger instance using the given Class as the suggested name
    • getName

      String getName()
      Returns:
      name of the logger instance
    • getLevel

      Level getLevel()
      Returns:
      log Level of the logger instance
    • isEnabled

      boolean isEnabled()
      Returns:
      true if the Logger instance is configured to be active per its name and Level, false otherwise
    • atTrace

      Logger atTrace()
      Returns:
      Logger instance with the same name, and TRACE log level
    • atDebug

      Logger atDebug()
      Returns:
      Logger instance with the same name, and DEBUG log level
    • atInfo

      Logger atInfo()
      Returns:
      Logger instance with the same name, and INFO log level
    • atWarn

      Logger atWarn()
      Returns:
      Logger instance with the same name, and WARN log level
    • atError

      Logger atError()
      Returns:
      Logger instance with the same name, and ERROR log level
    • log

      void log(Object message)
      Parameters:
      message - to be logged. If the actual type is Supplier, the result of Supplier.get(), instead of the message itself, should be used to construct the final log message.
    • log

      void log(String message, Object... args)
      Parameters:
      message - to be logged
      args - the arguments to replace the placeholders in the message. If any of the argument's actual type is Supplier, the result of Supplier.get(), instead of the argument itself, should be used to construct the final log message.
    • log

      void log(Throwable t)
      Parameters:
      t - the Throwable to be logged
    • log

      void log(Throwable t, Object message)
      Parameters:
      t - the Throwable to be logged
      message - the message to be logged. If the actual type is Supplier, the result of Supplier.get(), instead of the message itself, should be used to construct the final log message.
    • log

      void log(Throwable t, String message, Object... args)
      Parameters:
      t - the Throwable to be logged
      message - the message to be logged
      args - the arguments to replace the placeholders in the message. If any of argument's actual type is Supplier, the result of Supplier.get(), instead of the argument itself, should be used to construct the final log message.