Package 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.- Author:
- jrandom
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Log(Class<?> cls)
Warning - not recommended.Log(String name)
Warning - not recommended.Log(LogManager manager, Class<?> cls)
Log(LogManager manager, Class<?> cls, String name)
Log(LogManager manager, String name)
-
Method Summary
Modifier and Type Method 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()
(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()
boolean
shouldError()
boolean
shouldInfo()
boolean
shouldLog(int priority)
boolean
shouldWarn()
static String
toLevelString(int level)
void
warn(String msg)
void
warn(String msg, Throwable t)
-
Field Details
-
DEBUG
public static final int DEBUG- See Also:
- Constant Field Values
-
INFO
public static final int INFO- See Also:
- Constant Field Values
-
WARN
public static final int WARN- See Also:
- Constant Field Values
-
ERROR
public static final int ERROR- See Also:
- Constant Field Values
-
CRIT
public static final int CRIT- See Also:
- Constant Field Values
-
STR_DEBUG
- See Also:
- Constant Field Values
-
STR_INFO
- See Also:
- Constant Field Values
-
STR_WARN
- See Also:
- Constant Field Values
-
STR_ERROR
- See Also:
- Constant Field Values
-
STR_CRIT
- See Also:
- Constant Field Values
-
-
Constructor Details
-
Log
Warning - not recommended. Use I2PAppContext.getGlobalContext().logManager().getLog(cls) -
Log
Warning - not recommended. Use I2PAppContext.getGlobalContext().logManager().getLog(name) -
Log
Log(LogManager manager, Class<?> cls) -
Log
Log(LogManager manager, String name) -
Log
Log(LogManager manager, Class<?> cls, String name)
-
-
Method Details
-
getLevel
-
toLevelString
-
log
-
log
-
logAlways
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.- Since:
- 0.8.2
-
debug
-
debug
-
info
-
info
-
warn
-
warn
-
error
-
error
-
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
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
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 resourcelevel
- level at which to log- Since:
- 0.9.8
-
getName
-
getScope
- Returns:
- the LogScope (private class)
-
getScope
-