Package net.i2p.util

Class 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);
    Author:
    jrandom
    • Constructor Detail

      • Log

        public Log​(Class<?> cls)
        Warning - not recommended. Use I2PAppContext.getGlobalContext().logManager().getLog(cls)
      • Log

        public Log​(String name)
        Warning - not recommended. Use I2PAppContext.getGlobalContext().logManager().getLog(name)
    • Method Detail

      • getLevel

        public static int getLevel​(String level)
      • toLevelString

        public static String toLevelString​(int level)
      • log

        public void log​(int priority,
                        String msg)
      • logAlways

        public void logAlways​(int priority,
                              String msg)
        Always log this messge with the given priority, ignoring current minimum priority level. This allows an INFO message about changing port numbers, for example, to always be logged.
        Since:
        0.8.2
      • debug

        public void debug​(String msg)
      • info

        public void info​(String msg)
      • warn

        public void warn​(String msg)
      • error

        public void error​(String msg)
      • getMinimumPriority

        public int getMinimumPriority()
      • setMinimumPriority

        public void setMinimumPriority​(int priority)
      • shouldLog

        public boolean shouldLog​(int priority)
      • shouldDebug

        public boolean shouldDebug()
        Since:
        0.9.20
      • shouldInfo

        public boolean shouldInfo()
        Since:
        0.9.20
      • shouldWarn

        public boolean shouldWarn()
        Since:
        0.9.20
      • shouldError

        public boolean shouldError()
        Since:
        0.9.20
      • 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
        Since:
        0.9.8
      • 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
        Since:
        0.9.8
      • getName

        public String getName()
      • getScope

        public Object getScope()
        Returns:
        the LogScope (private class)