當前位置: 首頁>>代碼示例>>Java>>正文


Java LocationAwareLogger類代碼示例

本文整理匯總了Java中org.slf4j.spi.LocationAwareLogger的典型用法代碼示例。如果您正苦於以下問題:Java LocationAwareLogger類的具體用法?Java LocationAwareLogger怎麽用?Java LocationAwareLogger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LocationAwareLogger類屬於org.slf4j.spi包,在下文中一共展示了LocationAwareLogger類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: log

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
@Override
public void log(Marker marker, String callerFQCN, int level, String msg, Object[] argArray, Throwable t) {
    Level log4jLevel;
    switch (level) {
    case LocationAwareLogger.TRACE_INT:
        log4jLevel = traceCapable ? Level.TRACE : Level.DEBUG;
        break;
    case LocationAwareLogger.DEBUG_INT:
        log4jLevel = Level.DEBUG;
        break;
    case LocationAwareLogger.INFO_INT:
        log4jLevel = Level.INFO;
        break;
    case LocationAwareLogger.WARN_INT:
        log4jLevel = Level.WARN;
        break;
    case LocationAwareLogger.ERROR_INT:
        log4jLevel = Level.ERROR;
        break;
    default:
        throw new IllegalStateException("Level number " + level + " is not recognized.");
    }
    logger.log(callerFQCN, log4jLevel, msg, t);
}
 
開發者ID:AmadeusITGroup,項目名稱:HttpSessionReplacer,代碼行數:25,代碼來源:Log4jLoggerAdapter.java

示例2: slf4jLevelIntToJULLevel

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
private Level slf4jLevelIntToJULLevel(int slf4jLevelInt) {
    Level julLevel;
    switch (slf4jLevelInt) {
    case LocationAwareLogger.TRACE_INT:
        julLevel = Level.FINEST;
        break;
    case LocationAwareLogger.DEBUG_INT:
        julLevel = Level.FINE;
        break;
    case LocationAwareLogger.INFO_INT:
        julLevel = Level.INFO;
        break;
    case LocationAwareLogger.WARN_INT:
        julLevel = Level.WARNING;
        break;
    case LocationAwareLogger.ERROR_INT:
        julLevel = Level.SEVERE;
        break;
    default:
        throw new IllegalStateException("Level number " + slf4jLevelInt + " is not recognized.");
    }
    return julLevel;
}
 
開發者ID:AmadeusITGroup,項目名稱:HttpSessionReplacer,代碼行數:24,代碼來源:JDK14LoggerAdapter.java

示例3: log

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
@Override
public void log(String fqcn, Level level, Throwable t, String format, Object... arguments) {
	int level_int;
	switch (level) {
		case TRACE:
			level_int = LocationAwareLogger.TRACE_INT;
			break;
		case DEBUG:
			level_int = LocationAwareLogger.DEBUG_INT;
			break;
		case INFO:
			level_int = LocationAwareLogger.INFO_INT;
			break;
		case WARN:
			level_int = LocationAwareLogger.WARN_INT;
			break;
		case ERROR:
			level_int = LocationAwareLogger.ERROR_INT;
			break;
		default:
			throw new Error(StringKit.format("Can not identify level: {}", level));
	}
	this.locationAwareLog(fqcn, level_int, t, format, arguments);
}
 
開發者ID:Teddy-Zhu,項目名稱:SilentGo,代碼行數:25,代碼來源:Slf4jLog.java

示例4: toLocationAwareLoggerInteger

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
/**
 * Convert this level instance to an integer  value defined in the
 * {@link LocationAwareLogger} interface.
 *
 * @param level The level to convert to LocationAwareLogger integer
 * @return int An integer corresponding to this level as defined in LocationAwareLogger
 * @since 1.0.1
 */
public static int toLocationAwareLoggerInteger(Level level) {
  if (level == null)
    throw new IllegalArgumentException("null level parameter is not admitted");
  switch (level.toInt()) {
    case Level.TRACE_INT:
      return LocationAwareLogger.TRACE_INT;
    case Level.DEBUG_INT:
      return LocationAwareLogger.DEBUG_INT;
    case Level.INFO_INT:
      return LocationAwareLogger.INFO_INT;
    case Level.WARN_INT:
      return LocationAwareLogger.WARN_INT;
    case Level.ERROR_INT:
      return LocationAwareLogger.ERROR_INT;
    default:
      throw new IllegalArgumentException(level + " not a valid level value");
  }
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:27,代碼來源:Level.java

示例5: fromLocationAwareLoggerInteger

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
/**
 * Convert one of the integer values defined in {@link LocationAwareLogger}
 * interface to an instance of this class, i.e. a Level.
 *
 * @param levelInt An integer value representing a level as defined in LocationAwareLogger
 * @return an instance of this class, i.e. a Level.
 * @since 1.0.1
 */
public static Level fromLocationAwareLoggerInteger(int levelInt) {
  Level level;
  switch (levelInt) {
    case LocationAwareLogger.TRACE_INT:
      level = TRACE;
      break;
    case LocationAwareLogger.DEBUG_INT:
      level = DEBUG;
      break;
    case LocationAwareLogger.INFO_INT:
      level = INFO;
      break;
    case LocationAwareLogger.WARN_INT:
      level = WARN;
      break;
    case LocationAwareLogger.ERROR_INT:
      level = ERROR;
      break;
    default:
      throw new IllegalArgumentException(levelInt + " not a valid level value");
  }
  return level;
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:32,代碼來源:Level.java

示例6: publish

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
/**
 * Publish a LogRecord.
 * <p/>
 * The logging request was made initially to a Logger object, which
 * initialized the LogRecord and forwarded it here.
 * <p/>
 * This handler ignores the Level attached to the LogRecord, as SLF4J cares
 * about discarding log statements.
 *
 * @param record Description of the log event. A null record is silently ignored
 *               and is not published.
 */
public void publish(LogRecord record) {
    // Silently ignore null records.
    if (record == null) {
        return;
    }

    Logger slf4jLogger = getSLF4JLogger(record);
    String message = record.getMessage(); // can be null!
    // this is a check to avoid calling the underlying logging system
    // with a null message. While it is legitimate to invoke j.u.l. with
    // a null message, other logging frameworks do not support this.
    // see also http://bugzilla.slf4j.org/show_bug.cgi?id=108
    if (message == null) {
        message = "";
    }
    if (slf4jLogger instanceof LocationAwareLogger) {
        callLocationAwareLogger((LocationAwareLogger) slf4jLogger, record);
    } else {
        callPlainSLF4JLogger(slf4jLogger, record);
    }
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:34,代碼來源:SLF4JBridgeHandler.java

示例7: callLocationAwareLogger

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
protected void callLocationAwareLogger(LocationAwareLogger lal, LogRecord record) {
    int julLevelValue = record.getLevel().intValue();
    int slf4jLevel;

    if (julLevelValue <= TRACE_LEVEL_THRESHOLD) {
        slf4jLevel = LocationAwareLogger.TRACE_INT;
    } else if (julLevelValue <= DEBUG_LEVEL_THRESHOLD) {
        slf4jLevel = LocationAwareLogger.DEBUG_INT;
    } else if (julLevelValue <= INFO_LEVEL_THRESHOLD) {
        slf4jLevel = LocationAwareLogger.INFO_INT;
    } else if (julLevelValue <= WARN_LEVEL_THRESHOLD) {
        slf4jLevel = LocationAwareLogger.WARN_INT;
    } else {
        slf4jLevel = LocationAwareLogger.ERROR_INT;
    }
    String i18nMessage = getMessageI18N(record);
    lal.log(null, FQCN, slf4jLevel, i18nMessage, null, record.getThrown());
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:19,代碼來源:SLF4JBridgeHandler.java

示例8: differentiatedLog

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
void differentiatedLog(Marker marker, String fqcn, int level, Object message, Throwable t) {

        String m = convertToString(message);
        if (locationAwareLogger != null) {
            locationAwareLogger.log(marker, fqcn, level, m, null, t);
        } else {
            switch (level) {
            case LocationAwareLogger.TRACE_INT:
                slf4jLogger.trace(marker, m);
                break;
            case LocationAwareLogger.DEBUG_INT:
                slf4jLogger.debug(marker, m);
                break;
            case LocationAwareLogger.INFO_INT:
                slf4jLogger.info(marker, m);
                break;
            case LocationAwareLogger.WARN_INT:
                slf4jLogger.warn(marker, m);
                break;
            case LocationAwareLogger.ERROR_INT:
                slf4jLogger.error(marker, m);
                break;
            }
        }
    }
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:26,代碼來源:Category.java

示例9: LambdaLoggerLocationAwareImpl

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
public LambdaLoggerLocationAwareImpl(LocationAwareLogger underlyingLogger) {
    if (underlyingLogger == null) {
        throw new IllegalArgumentException("underlyingLogger must not be null.");
    }

    this.underlyingLogger = underlyingLogger;
}
 
開發者ID:kwon37xi,項目名稱:slf4j-lambda,代碼行數:8,代碼來源:LambdaLoggerLocationAwareImpl.java

示例10: buildLambdaLogger

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
@Override
public LambdaLogger buildLambdaLogger(Logger underlyingLogger) {
    if (underlyingLogger instanceof LocationAwareLogger) {
        return new LambdaLoggerLocationAwareImpl((LocationAwareLogger) underlyingLogger);
    }
    return new LambdaLoggerPlainImpl(underlyingLogger);
}
 
開發者ID:kwon37xi,項目名稱:slf4j-lambda,代碼行數:8,代碼來源:DefaultLambdaLoggerFactory.java

示例11: Slf4jESLogger

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
public Slf4jESLogger(String prefix, Logger logger) {
    super(prefix);
    this.logger = logger;
    if (logger instanceof LocationAwareLogger) {
        lALogger = (LocationAwareLogger) logger;
    } else {
        lALogger = null;
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:10,代碼來源:Slf4jESLogger.java

示例12: internalTrace

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
@Override
protected void internalTrace(String msg) {
    if (lALogger != null) {
        lALogger.log(null, FQCN, LocationAwareLogger.TRACE_INT, msg, null, null);
    } else {
        logger.trace(msg);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:9,代碼來源:Slf4jESLogger.java

示例13: internalDebug

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
@Override
protected void internalDebug(String msg) {
    if (lALogger != null) {
        lALogger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, msg, null, null);
    } else {
        logger.debug(msg);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:9,代碼來源:Slf4jESLogger.java

示例14: internalInfo

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
@Override
protected void internalInfo(String msg) {
    if (lALogger != null) {
        lALogger.log(null, FQCN, LocationAwareLogger.INFO_INT, msg, null, null);
    } else {
        logger.info(msg);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:9,代碼來源:Slf4jESLogger.java

示例15: internalWarn

import org.slf4j.spi.LocationAwareLogger; //導入依賴的package包/類
@Override
protected void internalWarn(String msg) {
    if (lALogger != null) {
        lALogger.log(null, FQCN, LocationAwareLogger.WARN_INT, msg, null, null);
    } else {
        logger.warn(msg);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:9,代碼來源:Slf4jESLogger.java


注:本文中的org.slf4j.spi.LocationAwareLogger類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。