本文整理汇总了Java中org.identityconnectors.common.logging.Log.Level类的典型用法代码示例。如果您正苦于以下问题:Java Level类的具体用法?Java Level怎么用?Java Level使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Level类属于org.identityconnectors.common.logging.Log包,在下文中一共展示了Level类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: log
import org.identityconnectors.common.logging.Log.Level; //导入依赖的package包/类
@Override
public void log(Class<?> clazz, String method, Level level, String message, Throwable ex) {
Trace LOGGER = TraceManager.getTrace(clazz);
//Mark all messages from ICF as ICF
Marker m = MarkerFactory.getMarker("ICF");
//Translate ICF logging into slf4j
// OK -> trace
// INFO -> debug
// WARN -> warn
// ERROR -> error
if (Level.OK.equals(level)) {
if (null == ex) {
LOGGER.trace(m, "method: {} msg:{}", method, message);
} else {
LOGGER.trace(m, "method: {} msg:{}", new Object[] { method, message }, ex);
}
} else if (Level.INFO.equals(level)) {
if (null == ex) {
LOGGER.debug(m, "method: {} msg:{}", method, message);
} else {
LOGGER.debug(m, "method: {} msg:{}", new Object[] { method, message }, ex);
}
} else if (Level.WARN.equals(level)) {
if (null == ex) {
LOGGER.warn(m, "method: {} msg:{}", method, message);
} else {
LOGGER.warn(m, "method: {} msg:{}", new Object[] { method, message }, ex);
}
} else if (Level.ERROR.equals(level)) {
if (null == ex) {
LOGGER.error(m, "method: {} msg:{}", method, message);
} else {
LOGGER.error(m, "method: {} msg:{}", new Object[] { method, message }, ex);
}
}
}
示例2: isLoggable
import org.identityconnectors.common.logging.Log.Level; //导入依赖的package包/类
@Override
public final boolean isLoggable(final Class<?> clazz,
final Level level) {
boolean loggable;
switch (level) {
case ERROR:
loggable = LOG.isErrorEnabled();
break;
case INFO:
loggable = LOG.isInfoEnabled();
break;
case OK:
loggable = LOG.isDebugEnabled();
break;
case WARN:
loggable = LOG.isWarnEnabled();
break;
default:
loggable = false;
}
return loggable;
}
示例3: isLoggable
import org.identityconnectors.common.logging.Log.Level; //导入依赖的package包/类
@Override
public boolean isLoggable(Class<?> clazz, Level level) {
return true;
}
示例4: needToInferCaller
import org.identityconnectors.common.logging.Log.Level; //导入依赖的package包/类
public boolean needToInferCaller(Class<?> clazz, Level level) {
return false;
}
示例5: log
import org.identityconnectors.common.logging.Log.Level; //导入依赖的package包/类
@Override
public final void log(final Class<?> clazz,
final String method,
final Level level,
final String message,
final Throwable ex) {
final StringBuilder logMessage = new StringBuilder();
logMessage.append(clazz.getName());
logMessage.append('.');
logMessage.append(method);
logMessage.append(' ');
logMessage.append(message);
switch (level) {
case ERROR:
if (ex != null) {
LOG.error(logMessage.toString(), ex);
} else {
LOG.error(logMessage.toString());
}
break;
case INFO:
if (ex != null) {
LOG.info(logMessage.toString(), ex);
} else {
LOG.info(logMessage.toString());
}
break;
case OK:
if (ex != null) {
LOG.debug(logMessage.toString(), ex);
} else {
LOG.debug(logMessage.toString());
}
break;
case WARN:
if (ex != null) {
LOG.warn(logMessage.toString(), ex);
} else {
LOG.warn(logMessage.toString());
}
break;
default:
}
}