net.i2p.util

## Class Log

- java.lang.Object
- - net.i2p.util.Log

-     public class Log
      extends Object

  Wrapper class for whatever logging system I2P uses. This class should be instantiated and kept as a variable for each class it is used by, e.g. `private final Log _log = context.logManager().getLog(MyClassName.class);` If there is anything in here that doesn't make sense, turn off your computer and go fly a kite.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CRIT`
    `static int` | `DEBUG`
    `static int` | `ERROR`
    `static int` | `INFO`
    `static String` | `STR_CRIT`
    `static String` | `STR_DEBUG`
    `static String` | `STR_ERROR`
    `static String` | `STR_INFO`
    `static String` | `STR_WARN`
    `static int` | `WARN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Log(Class<?> cls)` Warning - not recommended.
    `Log(LogManager manager, Class<?> cls)`
    `Log(LogManager manager, Class<?> cls, String name)`
    `Log(LogManager manager, String name)`
    `Log(String name)` Warning - not recommended.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `debug(String msg)`
    `void` | `debug(String msg, Throwable t)`
    `void` | `error(String msg)`
    `void` | `error(String msg, Throwable t)`
    `static int` | `getLevel(String level)`
    `int` | `getMinimumPriority()`
    `String` | `getName()`
    `Object` | `getScope()` Returns the LogScope (private class).
    `(package private) static String` | `getScope(String name, Class<?> cls)`
    `void` | `info(String msg)`
    `void` | `info(String msg, Throwable t)`
    `void` | `log(int priority, String msg)`
    `void` | `log(int priority, String msg, Throwable t)`
    `void` | `logAlways(int priority, String msg)` Always log this message with the given priority, ignoring current minimum priority level.
    `void` | `logCloseLoop(int level, Object... desc)` Logs a close loop when closing a resource This method is for debugging purposes only and is subject to change or removal w/o notice.
    `void` | `logCloseLoop(Object... desc)` logs a loop when closing a resource with level DEBUG This method is for debugging purposes only and is subject to change or removal w/o notice.
    `void` | `setMinimumPriority(int priority)`
    `boolean` | `shouldDebug()` Check if DEBUG level logging is enabled.
    `boolean` | `shouldError()` Check if ERROR level logging is enabled.
    `boolean` | `shouldInfo()` Check if INFO level logging is enabled.
    `boolean` | `shouldLog(int priority)`
    `boolean` | `shouldWarn()` Check if WARN level logging is enabled.
    `static String` | `toLevelString(int level)`
    `void` | `warn(String msg)`
    `void` | `warn(String msg, Throwable t)`

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

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

- - ### Field Detail

    - #### CRIT

          public static final int CRIT

      See Also:
        Constant Field Values

    - #### DEBUG

          public static final int DEBUG

      See Also:
        Constant Field Values

    - #### ERROR

          public static final int ERROR

      See Also:
        Constant Field Values

    - #### INFO

          public static final int INFO

      See Also:
        Constant Field Values

    - #### STR_CRIT

          public static final String STR_CRIT

      See Also:
        Constant Field Values

    - #### STR_DEBUG

          public static final String STR_DEBUG

      See Also:
        Constant Field Values

    - #### STR_ERROR

          public static final String STR_ERROR

      See Also:
        Constant Field Values

    - #### STR_INFO

          public static final String STR_INFO

      See Also:
        Constant Field Values

    - #### STR_WARN

          public static final String STR_WARN

      See Also:
        Constant Field Values

    - #### WARN

          public static final int WARN

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Log

          public Log(Class<?> cls)

      Warning - not recommended. Use I2PAppContext.getGlobalContext().logManager().getLog(cls)

    - #### Log

          Log(LogManager manager,
              Class<?> cls)

    - #### Log

          Log(LogManager manager,
              Class<?> cls,
              String name)

    - #### Log

          Log(LogManager manager,
              String name)

    - #### Log

          public Log(String name)

      Warning - not recommended. Use I2PAppContext.getGlobalContext().logManager().getLog(name)

  - ### Method Detail

    - #### debug

          public void debug(String msg)

    - #### debug

          public void debug(String msg,
                            Throwable t)

    - #### error

          public void error(String msg)

    - #### error

          public void error(String msg,
                            Throwable t)

    - #### getLevel

          public static int getLevel(String level)

    - #### getMinimumPriority

          public int getMinimumPriority()

    - #### getName

          public String getName()

    - #### getScope

          public Object getScope()

      Returns the LogScope (private class).
      Returns:
        the LogScope

    - #### getScope

          static String getScope(String name,
                                 Class<?> cls)

    - #### info

          public void info(String msg)

    - #### info

          public void info(String msg,
                           Throwable t)

    - #### log

          public void log(int priority,
                          String msg)

    - #### log

          public void log(int priority,
                          String msg,
                          Throwable t)

    - #### logAlways

          public void logAlways(int priority,
                                String msg)

      Always log this message with the given priority, ignoring current minimum priority level. This allows an INFO message about changing port numbers, for example, to always be logged.

    - #### logCloseLoop

          public void logCloseLoop(int level,
                                   Object... desc)

      Logs a close loop when closing a resource This method is for debugging purposes only and is subject to change or removal w/o notice. NOT a supported API.
      Parameters:
        `desc` - vararg description of the resource
        `level` - level at which to log

    - #### logCloseLoop

          public void logCloseLoop(Object... desc)

      logs a loop when closing a resource with level DEBUG This method is for debugging purposes only and is subject to change or removal w/o notice. NOT a supported API.
      Parameters:
        `desc` - vararg description

    - #### setMinimumPriority

          public void setMinimumPriority(int priority)

    - #### shouldDebug

          public boolean shouldDebug()

      Check if DEBUG level logging is enabled.

    - #### shouldError

          public boolean shouldError()

      Check if ERROR level logging is enabled.

    - #### shouldInfo

          public boolean shouldInfo()

      Check if INFO level logging is enabled.

    - #### shouldLog

          public boolean shouldLog(int priority)

    - #### shouldWarn

          public boolean shouldWarn()

      Check if WARN level logging is enabled.

    - #### toLevelString

          public static String toLevelString(int level)

    - #### warn

          public void warn(String msg)

    - #### warn

          public void warn(String msg,
                           Throwable t)