當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。