当前位置: 首页>>代码示例>>Java>>正文


Java Level类代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:38,代码来源:Slf4jConnectorLogger.java

示例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;
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:30,代码来源:SLF4JLogger.java

示例3: isLoggable

import org.identityconnectors.common.logging.Log.Level; //导入依赖的package包/类
@Override
public boolean isLoggable(Class<?> clazz, Level level) {
	return true;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:5,代码来源:Slf4jConnectorLogger.java

示例4: needToInferCaller

import org.identityconnectors.common.logging.Log.Level; //导入依赖的package包/类
public boolean needToInferCaller(Class<?> clazz, Level level) {
    return false;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:4,代码来源:Slf4jConnectorLogger.java

示例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:
    }
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:51,代码来源:SLF4JLogger.java


注:本文中的org.identityconnectors.common.logging.Log.Level类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。