Class LogLevel
- java.lang.Object
-
- com.elvishew.xlog.LogLevel
-
public class LogLevel extends java.lang.ObjectLog level indicate how important the log is.Usually when we log a message, we also specify the log level explicitly or implicitly, so if we setup a log level using
XLog.init(...), all the logs which is with a log level smaller than the setup one would not be printed.The priority of log levels is:
VERBOSE<DEBUG<INFO<WARN<ERROR.
And there are two special log levels which are usually used for Log#init:NONEandALL,NONEfor not printing any log andALLfor printing all logs.
-
-
Field Summary
Fields Modifier and Type Field Description static intALLLog level for XLog#init, printing all logs.static intDEBUGLog level for XLog.d.static intERRORLog level for XLog.e.static intINFOLog level for XLog.i.static intNONELog level for XLog#init, printing no log.static intVERBOSELog level for XLog.v.static intWARNLog level for XLog.w.
-
Constructor Summary
Constructors Constructor Description LogLevel()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetLevelName(int logLevel)Get a name representing the specified log level.static java.lang.StringgetShortLevelName(int logLevel)Get a short name representing the specified log level.
-
-
-
Field Detail
-
VERBOSE
public static final int VERBOSE
Log level for XLog.v.- See Also:
- Constant Field Values
-
DEBUG
public static final int DEBUG
Log level for XLog.d.- See Also:
- Constant Field Values
-
INFO
public static final int INFO
Log level for XLog.i.- See Also:
- Constant Field Values
-
WARN
public static final int WARN
Log level for XLog.w.- See Also:
- Constant Field Values
-
ERROR
public static final int ERROR
Log level for XLog.e.- See Also:
- Constant Field Values
-
ALL
public static final int ALL
Log level for XLog#init, printing all logs.- See Also:
- Constant Field Values
-
NONE
public static final int NONE
Log level for XLog#init, printing no log.- See Also:
- Constant Field Values
-
-
Method Detail
-
getLevelName
public static java.lang.String getLevelName(int logLevel)
Get a name representing the specified log level.The returned name may be
Level less thanVERBOSE: "VERBOSE-N", N means levels belowVERBOSE
VERBOSE: "VERBOSE"
DEBUG: "DEBUG"
INFO: "INFO"
WARN: "WARN"
ERROR: "ERROR"
Level greater thanERROR: "ERROR+N", N means levels aboveERROR- Parameters:
logLevel- the log level to get name for- Returns:
- the name
-
getShortLevelName
public static java.lang.String getShortLevelName(int logLevel)
Get a short name representing the specified log level.The returned name may be
Level less thanVERBOSE: "V-N", N means levels belowVERBOSE
VERBOSE: "V"
DEBUG: "D"
INFO: "I"
WARN: "W"
ERROR: "E"
Level greater thanERROR: "E+N", N means levels aboveERROR- Parameters:
logLevel- the log level to get short name for- Returns:
- the short name
-
-