本文整理汇总了Java中org.slf4j.helpers.MessageFormatter.format方法的典型用法代码示例。如果您正苦于以下问题:Java MessageFormatter.format方法的具体用法?Java MessageFormatter.format怎么用?Java MessageFormatter.format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.slf4j.helpers.MessageFormatter
的用法示例。
在下文中一共展示了MessageFormatter.format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: debug
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
final public void debug(String format, Object arg1, Object arg2) {
if (isDebugEnabled()) {
FormattingTuple ft = MessageFormatter.format(format, arg1, arg2);
LogRecord record = new LogRecord(Level.FINE, ft.getMessage());
record.setThrown(ft.getThrowable());
record.setLoggerName(name);
Logger.getLogger(name).log(record);
}
}
示例2: warn
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
final public void warn(String format, Object arg1) {
FormattingTuple ft = MessageFormatter.format(format, arg1);
LogRecord record = new LogRecord(Level.WARNING, ft.getMessage());
record.setThrown(ft.getThrowable());
record.setLoggerName(name);
Logger.getLogger(name).log(record);
}
示例3: error
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
final public void error(String format, Object arg1) {
FormattingTuple ft = MessageFormatter.format(format, arg1);
LogRecord record = new LogRecord(Level.SEVERE, ft.getMessage());
record.setThrown(ft.getThrowable());
record.setLoggerName(name);
Logger.getLogger(name).log(record);
}
示例4: error
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
public void error(final String format, final Object arg) {
final FormattingTuple ft = MessageFormatter.format(format, arg);
Crashlytics.log(Log.ERROR, mTag, ft.getMessage());
if (ft.getThrowable() != null) {
exception(Log.ERROR, ft.getThrowable());
}
}
示例5: error
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
* Log a message at the ERROR level according to the specified format and argument.
* This form avoids superfluous object creation when the logger is disabled for the ERROR level.
*
* @param format the format string
* @param arg the argument
*/
public void error(String format, Object arg) {
if (logger.isEnabledFor(Level.ERROR)) {
FormattingTuple ft = MessageFormatter.format(format, arg);
logger.log(getCallerClassName(), Level.ERROR, ft.getMessage(),
ft.getThrowable());
}
}
示例6: warn
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
* Log a message at the WARN level according to the specified format and argument.
* This form avoids superfluous object creation when the logger is disabled for the WARN level.
*
* @param format the format string
* @param arg the argument
*/
public void warn(String format, Object arg) {
if (logger.isEnabledFor(Level.WARN)) {
FormattingTuple ft = MessageFormatter.format(format, arg);
logger.log(getCallerClassName(), Level.WARN, ft.getMessage(),
ft.getThrowable());
}
}
示例7: info
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
final public void info(String format, Object arg1) {
FormattingTuple ft = MessageFormatter.format(format, arg1);
LogRecord record = new LogRecord(Level.INFO, ft.getMessage());
record.setThrown(ft.getThrowable());
record.setLoggerName(name);
Logger.getLogger(name).log(record);
}
示例8: trace
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
public void trace(final String format, final Object arg) {
final FormattingTuple ft = MessageFormatter.format(format, arg);
Crashlytics.log(Log.VERBOSE, mTag, ft.getMessage());
if (ft.getThrowable() != null) {
exception(Log.VERBOSE, ft.getThrowable());
}
}
示例9: doLog
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
private void doLog(Level lvl, String format, Object arg) {
if (this.logger.isLoggable(lvl)) {
FormattingTuple tuple = MessageFormatter.format(format, arg);
doLog(lvl, tuple);
}
}
示例10: formatAndLog
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
* For formatted messages, first substitute arguments and then log.
*
* @param level
* @param format
* @param arg1
* @param arg2
*/
private void formatAndLog(int level, String format, Object arg1, Object arg2) {
if (!isLevelEnabled(level)) {
return;
}
FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
log(level, tp.getMessage(), tp.getThrowable());
}
示例11: info
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
* Log a message at the INFO level according to the specified format and arguments.
* This form avoids superfluous object creation when the logger is disabled for the INFO level.
*
* @param format the format string
* @param arg1 the first argument
* @param arg2 the second argument
*/
public void info(String format, Object arg1, Object arg2) {
if (logger.isInfoEnabled()) {
FormattingTuple ft = MessageFormatter.format(format, arg1, arg2);
logger.log(getCallerClassName(), Level.INFO, ft.getMessage(),
ft.getThrowable());
}
}
示例12: error
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
* Log a message at the ERROR level according to the specified format and
* arguments.
*
* <p>
* This form avoids superfluous object creation when the logger is disabled
* for the ERROR level.
* </p>
*
* @param format
* the format string
* @param arg1
* the first argument
* @param arg2
* the second argument
*/
@Override
public void error(String format, Object arg1, Object arg2) {
if (logger.isEnabledFor(Level.ERROR)) {
FormattingTuple ft = MessageFormatter.format(format, arg1, arg2);
logger.log(FQCN, Level.ERROR, ft.getMessage(), ft.getThrowable());
}
}
示例13: debug
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
* Log a message at level FINE according to the specified format and
* arguments.
*
* <p>
* This form avoids superfluous object creation when the logger is disabled
* for the FINE level.
* </p>
*
* @param format
* the format string
* @param arg1
* the first argument
* @param arg2
* the second argument
*/
@Override
public void debug(String format, Object arg1, Object arg2) {
if (logger.isLoggable(Level.FINE)) {
FormattingTuple ft = MessageFormatter.format(format, arg1, arg2);
log(SELF, Level.FINE, ft.getMessage(), ft.getThrowable());
}
}
示例14: info
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
* 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 arg
* the argument
*/
@Override
public void info(String format, Object arg) {
if (log.isInfoEnabled()) {
FormattingTuple ft = MessageFormatter.format(format, arg);
log.info(ft.getMessage(), ft.getThrowable());
}
}
示例15: error
import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
* Delegates to the {@link Log#error(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 ERROR.
* </p>
*
* @param format
* the format string
* @param arg
* the argument
*/
@Override
public void error(String format, Object arg) {
if (log.isErrorEnabled()) {
FormattingTuple ft = MessageFormatter.format(format, arg);
log.error(ft.getMessage(), ft.getThrowable());
}
}