customlevel.java
来自「STRUTS数据库项目开发宝典」· Java 代码 · 共 54 行
JAVA
54 行
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 + =
减小字号Ctrl + -
显示快捷键?