org.slf4j.helpers.MessageFormatter#arrayFormat ( )源码实例Demo

下面列出了org.slf4j.helpers.MessageFormatter#arrayFormat ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jboot   文件: Slf4jLogger.java
@Override
public void error(String format, Object... args) {
    if (isErrorEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, args);
        JbootExceptionHolder.hold(ft.getMessage(), ft.getThrowable());
        log.log(null, callerFQCN, LocationAwareLogger.ERROR_INT, ft.getMessage(), NULL_ARGS, ft.getThrowable());
    }
}
 
源代码2 项目: datax-web   文件: JobLogger.java
/**
 * append log with pattern
 *
 * @param appendLogPattern   like "aaa {} bbb {} ccc"
 * @param appendLogArguments like "111, true"
 */
public static void log(String appendLogPattern, Object... appendLogArguments) {

    FormattingTuple ft = MessageFormatter.arrayFormat(appendLogPattern, appendLogArguments);
    String appendLog = ft.getMessage();

    /*appendLog = appendLogPattern;
    if (appendLogArguments!=null && appendLogArguments.length>0) {
        appendLog = MessageFormat.format(appendLogPattern, appendLogArguments);
    }*/

    StackTraceElement callInfo = new Throwable().getStackTrace()[1];
    logDetail(callInfo, appendLog);
}
 
源代码3 项目: jboot   文件: Slf4jSimpleLogger.java
@Override
public void error(String format, Object... args) {
    if (isErrorEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, args);
        JbootExceptionHolder.hold(ft.getMessage(), ft.getThrowable());
        log.error(format, args);
    }
}
 
源代码4 项目: zuihou-admin-boot   文件: XxlJobLogger.java
/**
 * append log with pattern
 *
 * @param appendLogPattern   like "aaa {} bbb {} ccc"
 * @param appendLogArguments like "111, true"
 */
public static void log(String appendLogPattern, Object... appendLogArguments) {

    FormattingTuple ft = MessageFormatter.arrayFormat(appendLogPattern, appendLogArguments);
    String appendLog = ft.getMessage();

    /*appendLog = appendLogPattern;
    if (appendLogArguments!=null && appendLogArguments.length>0) {
        appendLog = MessageFormat.format(appendLogPattern, appendLogArguments);
    }*/

    StackTraceElement callInfo = new Throwable().getStackTrace()[1];
    logDetail(callInfo, appendLog);
}
 
源代码5 项目: snowflake-jdbc   文件: SLF4JLogger.java
public void error(String msg, Object... arguments)
{
  if (isErrorEnabled())
  {
    FormattingTuple ft = MessageFormatter.arrayFormat(
        msg, evaluateLambdaArgs(arguments));
    this.error(SecretDetector.maskSecrets(ft.getMessage()));
  }
}
 
源代码6 项目: slf4j-lambda   文件: LambdaLoggerPlainImpl.java
@Override
public void doLog(Marker marker, Level level, String format, Supplier<?>[] argSuppliers, Throwable t) {
    if (!LambdaLoggerUtils.isLogLevelEnabled(underlyingLogger, level, marker)) {
        return;
    }

    if (argSuppliers == null) {
        logFormatted(marker, level, format, t);
    } else {
        FormattingTuple formattingTuple = MessageFormatter.arrayFormat(format, argSuppliersToArgs(argSuppliers), t);
        logFormatted(marker, level, formattingTuple.getMessage(), formattingTuple.getThrowable());
    }
}
 
源代码7 项目: jboot   文件: Slf4jLogger.java
@Override
public void info(String format, Object... args) {
    if (isInfoEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, args);
        log.log(null, callerFQCN, LocationAwareLogger.INFO_INT, ft.getMessage(), NULL_ARGS, ft.getThrowable());
    }
}
 
源代码8 项目: snowflake-jdbc   文件: SLF4JLogger.java
public void debug(String msg, Object... arguments)
{
  // use this as format example for JDK14Logger.
  if (isDebugEnabled())
  {
    FormattingTuple ft = MessageFormatter.arrayFormat(
        msg, evaluateLambdaArgs(arguments));
    this.debug(SecretDetector.maskSecrets(ft.getMessage()));
  }
}
 
源代码9 项目: jboot   文件: Slf4jLogger.java
@Override
public void warn(String format, Object... args) {
    if (isWarnEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, args);
        log.log(null, callerFQCN, LocationAwareLogger.WARN_INT, ft.getMessage(), NULL_ARGS, ft.getThrowable());
    }
}
 
源代码10 项目: snowflake-jdbc   文件: SLF4JLogger.java
public void trace(String msg, Object... arguments)
{
  if (isTraceEnabled())
  {
    FormattingTuple ft = MessageFormatter.arrayFormat(
        msg, evaluateLambdaArgs(arguments));
    this.trace(SecretDetector.maskSecrets(ft.getMessage()));
  }
}
 
源代码11 项目: eclair   文件: JavaLoggerFacade.java
@Override
public void log(LogLevel level, String format, Object... arguments) {
    FormattingTuple formattingTuple = MessageFormatter.arrayFormat(format, arguments);
    String message = formattingTuple.getMessage();
    Throwable throwable = formattingTuple.getThrowable();
    logger.log(LEVELS.get(level), message, throwable);
}
 
源代码12 项目: openzaly   文件: LogUtils.java
public static void dbDebugLog(Logger logger, long startTime, Object result, String sql, Object... objects) {
	String messagePattern = sql.replace("?", "{}");
	FormattingTuple format = MessageFormatter.arrayFormat(messagePattern, objects);
	logger.debug("[openzaly-db] cost:{}ms result:{} sql:{}", System.currentTimeMillis() - startTime, result,
			format.getMessage());
}
 
源代码13 项目: openzaly   文件: LogUtils.java
public static void info(org.apache.log4j.Logger logger, String messagePattern, Object... objects) {
	FormattingTuple format = MessageFormatter.arrayFormat(messagePattern, objects);
	logger.info(format.getMessage());
}
 
源代码14 项目: HttpSessionReplacer   文件: JDK14LoggerAdapter.java
/**
 * Log a message at level WARNING according to the specified format and
 * arguments.
 *
 * <p>
 * This form avoids superfluous object creation when the logger is disabled
 * for the WARNING level.
 * </p>
 *
 * @param format
 *          the format string
 * @param argArray
 *          an array of arguments
 */
@Override
public void warn(String format, Object... argArray) {
    if (logger.isLoggable(Level.WARNING)) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
        log(SELF, Level.WARNING, ft.getMessage(), ft.getThrowable());
    }
}
 
源代码15 项目: HttpSessionReplacer   文件: JCLLoggerAdapter.java
/**
 * Delegates to the {@link Log#trace(java.lang.Object)} method of the underlying
 * {@link Log} instance.
 *
 * <p>
 * However, this form avoids superfluous object creation when the logger is disabled
 * for level TRACE.
 * </p>
 *
 * @param format the format string
 * @param arguments a list of 3 or more arguments
 */
@Override
public void trace(String format, Object... arguments) {
    if (log.isTraceEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
        log.trace(ft.getMessage(), ft.getThrowable());
    }
}
 
源代码16 项目: HttpSessionReplacer   文件: Log4jLoggerAdapter.java
/**
 * Log a message at level WARN according to the specified format and
 * arguments.
 *
 * <p>
 * This form avoids superfluous object creation when the logger is disabled
 * for the WARN level.
 * </p>
 *
 * @param format
 *          the format string
 * @param argArray
 *          an array of arguments
 */
@Override
public void warn(String format, Object... argArray) {
    if (logger.isEnabledFor(Level.WARN)) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
        logger.log(FQCN, Level.WARN, ft.getMessage(), ft.getThrowable());
    }
}
 
源代码17 项目: HttpSessionReplacer   文件: Log4jLoggerAdapter.java
/**
 * Log a message at level INFO according to the specified format and
 * arguments.
 *
 * <p>
 * This form avoids superfluous object creation when the logger is disabled
 * for the INFO level.
 * </p>
 *
 * @param format
 *          the format string
 * @param argArray
 *          an array of arguments
 */
@Override
public void info(String format, Object... argArray) {
    if (logger.isInfoEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
        logger.log(FQCN, Level.INFO, ft.getMessage(), ft.getThrowable());
    }
}
 
源代码18 项目: HttpSessionReplacer   文件: JDK14LoggerAdapter.java
/**
 * Log a message at level SEVERE according to the specified format and
 * arguments.
 *
 * <p>
 * This form avoids superfluous object creation when the logger is disabled
 * for the SEVERE level.
 * </p>
 *
 * @param format
 *          the format string
 * @param arguments
 *          an array of arguments
 */
@Override
public void error(String format, Object... arguments) {
    if (logger.isLoggable(Level.SEVERE)) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
        log(SELF, Level.SEVERE, ft.getMessage(), ft.getThrowable());
    }
}
 
源代码19 项目: HttpSessionReplacer   文件: JCLLoggerAdapter.java
/**
 * Delegates to the {@link Log#debug(java.lang.Object)} method of the underlying
 * {@link Log} instance.
 *
 * <p>
 * However, this form avoids superfluous object creation when the logger is disabled
 * for level DEBUG.
 * </p>
 *
 * @param format the format string
 * @param arguments a list of 3 or more arguments
 */
@Override
public void debug(String format, Object... arguments) {
    if (log.isDebugEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
        log.debug(ft.getMessage(), ft.getThrowable());
    }
}
 
源代码20 项目: HttpSessionReplacer   文件: JCLLoggerAdapter.java
/**
 * Delegates to the {@link Log#info(java.lang.Object)} method of the underlying
 * {@link Log} instance.
 *
 * <p>
 * However, this form avoids superfluous object creation when the logger is disabled
 * for level INFO.
 * </p>
 *
 * @param format the format string
 * @param arguments a list of 3 or more arguments
 */
@Override
public void info(String format, Object... arguments) {
    if (log.isInfoEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
        log.info(ft.getMessage(), ft.getThrowable());
    }
}