本文整理汇总了Java中org.slf4j.Logger.isErrorEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.isErrorEnabled方法的具体用法?Java Logger.isErrorEnabled怎么用?Java Logger.isErrorEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.slf4j.Logger
的用法示例。
在下文中一共展示了Logger.isErrorEnabled方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: error
import org.slf4j.Logger; //导入方法依赖的package包/类
public static void error(Logger log, Throwable th) {
if (!log.isErrorEnabled()) {
return;
}
// this operation is expensive, hence don't abuse it.
StackTraceElement[] traces = Thread.currentThread().getStackTrace();
if (traces.length > 2) {
StackTraceElement trace = traces[2];
log.error("({} {}), {}: {}", trace.getMethodName(), trace.getLineNumber(),
th.getClass().getName(), getMessage(th));
} else {
log.error("{}: {}", th.getClass().getName(), getMessage(th));
}
log.debug("Exception", th);
}
示例2: getLoggerLevel
import org.slf4j.Logger; //导入方法依赖的package包/类
public static int getLoggerLevel(Logger logger) {
if (logger == null) {
throw new NullPointerException("logger must not be null");
}
if (logger.isTraceEnabled()) {
return TRACE_LEVEL;
}
if (logger.isDebugEnabled()) {
return DEBUG_LEVEL;
}
if (logger.isInfoEnabled()) {
return INFO_LEVEL;
}
if (logger.isWarnEnabled()) {
return WARN_LEVEL;
}
if (logger.isErrorEnabled()) {
return ERROR_LEVEL;
}
return DISABLE_LEVEL;
}
示例3: isLogLevelEnabled
import org.slf4j.Logger; //导入方法依赖的package包/类
/**
* check if log level is enabled in the underlying logger
*
* @param underlyingLogger real Slf4j Logger implementation
* @param logLevel log level
* @param marker marker
* @return true if log level is enabled or false.
*/
public static boolean isLogLevelEnabled(Logger underlyingLogger, Level logLevel, Marker marker) {
switch (logLevel) {
case TRACE:
if (marker == null) {
return underlyingLogger.isTraceEnabled();
}
return underlyingLogger.isTraceEnabled(marker);
case DEBUG:
if (marker == null) {
return underlyingLogger.isDebugEnabled();
}
return underlyingLogger.isDebugEnabled(marker);
case INFO:
if (marker == null) {
return underlyingLogger.isInfoEnabled();
}
return underlyingLogger.isInfoEnabled(marker);
case WARN:
if (marker == null) {
return underlyingLogger.isWarnEnabled();
}
return underlyingLogger.isWarnEnabled(marker);
case ERROR:
if (marker == null) {
return underlyingLogger.isErrorEnabled();
}
return underlyingLogger.isErrorEnabled(marker);
default:
break;
}
return false;
}
示例4: validateAndLog
import org.slf4j.Logger; //导入方法依赖的package包/类
public boolean validateAndLog(BlockHeader header, Logger logger) {
ValidationResult result = validate(header);
if (!result.success && logger.isErrorEnabled()) {
logger.warn("{} invalid {}", getEntityClass(), result.error);
}
return result.success;
}
示例5: logErrors
import org.slf4j.Logger; //导入方法依赖的package包/类
public void logErrors(Logger logger) {
if (logger.isErrorEnabled()) {
for (String msg : errors) {
logger.warn("{} invalid: {}", getEntityClass().getSimpleName(), msg);
}
}
}
示例6: getLogLevel
import org.slf4j.Logger; //导入方法依赖的package包/类
public static LogLevel getLogLevel( Logger logger ) {
if( logger.isTraceEnabled() )
return LogLevel.TRACE;
else if( logger.isDebugEnabled() )
return LogLevel.DEBUG;
else if( logger.isInfoEnabled() )
return LogLevel.INFO;
else if( logger.isWarnEnabled() )
return LogLevel.WARN;
else if( logger.isErrorEnabled() )
return LogLevel.ERROR;
return LogLevel.NONE;
}
示例7: error
import org.slf4j.Logger; //导入方法依赖的package包/类
/**
* error
* @param logger
* @param message
* @param params
*/
public static void error(Logger logger, String message, Object... params) {
if (logger.isErrorEnabled()) {
logger.error(message, params);
}
}
示例8: error
import org.slf4j.Logger; //导入方法依赖的package包/类
public static void error(Logger logger,String format,Supplier<Object> supplier){
if(logger.isErrorEnabled()){
logger.error(format,supplier.get());
}
}
示例9: logErrors
import org.slf4j.Logger; //导入方法依赖的package包/类
public void logErrors(Logger logger) {
if (logger.isErrorEnabled())
for (String msg : errors) {
logger.warn("{} invalid: {}", getEntityClass().getSimpleName(), msg);
}
}
示例10: consoleError
import org.slf4j.Logger; //导入方法依赖的package包/类
public static void consoleError(Logger logger, ScriptObjectMirror args) {
if (logger.isErrorEnabled()) {
logger.error(logMessage(args));
}
}
示例11: error
import org.slf4j.Logger; //导入方法依赖的package包/类
public static void error(Logger logger, String format, Supplier<Object> supplier) {
if (logger.isErrorEnabled()) {
logger.error(format, supplier.get());
}
}
示例12: error
import org.slf4j.Logger; //导入方法依赖的package包/类
/**
* error level
* @param logger
* @param s
* @param objs
*/
public static void error(Logger logger,String s,Object... objs){
if(logger.isErrorEnabled()){
logger.error(s,objs);
}
}