📄 customlevel.java
字号:
package com.helpsoft.util.log;
import java.util.logging.Level;
/**
* A class for making custom levels for logging.
*
* @author caoguangxin- www.relationinfo.com
*/
class CustomLevel extends Level {
/** a Level for DEBUG */
public static final Level DEBUG = new CustomLevel("DEBUG", Level.INFO.intValue() - 1);
/** a Level for ERROR */
public static final Level ERROR = new CustomLevel("ERROR", Level.SEVERE.intValue() - 1);
/** a Level for FATAL */
public static final Level FATAL = new CustomLevel("FATAL", Level.SEVERE.intValue() + 1);
/**
* Constrcutor for making a custom level.
* @param name, the name of the Level
* @param value, the value for the level
*/
public CustomLevel(String name, int value) {
super(name, value);
}
/**
* Parse a levelName to a Level object.
* @param levelName the name of the Level to parse to a Level obhect
* @return Level the Level object parsed
*/
public static Level parse(String levelName) {
if (levelName.equals("DEBUG")) {
return DEBUG;
}
else if (levelName.equals("ERROR")) {
return ERROR;
}
else if (levelName.equals("FATAL")) {
return FATAL;
}
else {
return Level.parse(levelName);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -