panda.log.LogLevel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of panda-core Show documentation
Show all versions of panda-core Show documentation
Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.
package panda.log;
import panda.lang.Strings;
/**
*/
public enum LogLevel {
TRACE,
DEBUG,
INFO,
WARN,
ERROR,
FATAL;
public boolean isLess(LogLevel level) {
return ordinal() < level.ordinal();
}
public boolean isLessOrEqual(LogLevel level) {
return ordinal() <= level.ordinal();
}
public boolean isGreater(LogLevel level) {
return ordinal() > level.ordinal();
}
public boolean isGreaterOrEqual(LogLevel level) {
return ordinal() >= level.ordinal();
}
public static LogLevel parse(String level) {
if (Strings.isEmpty(level)) {
return TRACE;
}
switch (level.charAt(0)) {
case 'd':
case 'D':
return DEBUG;
case 'i':
case 'I':
return INFO;
case 'w':
case 'W':
return WARN;
case 'e':
case 'E':
return ERROR;
case 'f':
case 'F':
return FATAL;
case 't':
case 'T':
default:
return TRACE;
}
}
}