Package com.norconex.commons.lang

# Class Slf4jUtil

java.lang.Object
com.norconex.commons.lang.Slf4jUtil

public final class Slf4jUtil extends Object
Provides convenience methods complementing the SLF4J offerings.

Since:
  2.0.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Level`
  `fromJavaLevel(Level javaLevel)`
  Converts a Java `Level` to a SLF4J `Level`.
  `static Level`
  `getLevel(Logger logger)`
  Gets the finest log level supported by the supplied logger.
  `static boolean`
  `isEnabled(Logger logger, Level level)`
  Gets whether the supplied log level is enabled for the given logger.
  `static void`
  `log(Logger logger, String level, String format, Object... args)`
  Logs a message with a dynamically set SLF4J log `Level`.
  `static void`
  `log(Logger logger, Level level, String format, Object... args)`
  Logs a message with a dynamically set SLF4J log `Level`.
  `static Level`
  `toJavaLevel(Level level)`
  Converts a SLF4J `Level` to a Java `Level`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### log

    public static void log(Logger logger, String level, String format, Object... args)
    Logs a message with a dynamically set SLF4J log `Level`. As of this writing, SLF4J did not offer such ability.
    Parameters:
      `logger` - the original logger
      `level` - the log level
      `format` - formatted log message
      `args` - log arguments

  - ### log

    public static void log(Logger logger, Level level, String format, Object... args)
    Logs a message with a dynamically set SLF4J log `Level`. As of this writing, SLF4J did not offer such ability.
    Parameters:
      `logger` - the original logger
      `level` - the log level
      `format` - formatted log message
      `args` - log arguments

  - ### isEnabled

    public static boolean isEnabled(Logger logger, Level level)
    Gets whether the supplied log level is enabled for the given logger.
    Parameters:
      `logger` - logger
      `level` - level
    Returns:
      `true` if enabled

  - ### getLevel

    public static Level getLevel(Logger logger)
    Gets the finest log level supported by the supplied logger.
    Parameters:
      `logger` - the logger to get the finest level from
    Returns:
      finest log level

  - ### fromJavaLevel

    public static Level fromJavaLevel(Level javaLevel)
    Converts a Java `Level` to a SLF4J `Level`.
    Parameters:
      `javaLevel` - java level
    Returns:
      SLF4J Level

  - ### toJavaLevel

    public static Level toJavaLevel(Level level)
    Converts a SLF4J `Level` to a Java `Level`.
    Parameters:
      `level` - SLF4J Level
    Returns:
      java level