Java Examples for org.slf4j.helpers.FormattingTuple
The following java examples will help you to understand the usage of org.slf4j.helpers.FormattingTuple. These source code samples are taken from different open source projects.
Example 1
| Project: slf4android-master File: MessageValueSupplier.java View source code |
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@Override
public void append(LogRecord record, StringBuilder builder) {
FormattingTuple formattingTuple = MessageFormatter.arrayFormat(record.getMessage(), record.getParameters());
String message = formattingTuple.getMessage();
Throwable throwable = formattingTuple.getThrowable();
if (throwable != null) {
StringWriter writer = new StringWriter(100);
PrintWriter printWriter = new PrintWriter(writer);
throwable.printStackTrace(printWriter);
printWriter.flush();
printWriter.close();
writer.flush();
message += " " + writer.toString();
}
builder.append(message);
}Example 2
| Project: sling-master File: JSONRecording.java View source code |
private static String[] getParams(FormattingTuple tuple) {
//Eagerly convert arg to string so that if arg is bound by context like
//session then it gets evaluated when that is valid i.e. at time of call itself
Object[] params = tuple.getArgArray();
String[] strParams = null;
if (params != null) {
strParams = new String[params.length];
for (int i = 0; i < params.length; i++) {
strParams[i] = toString(params[i]);
}
}
return strParams;
}Example 3
| Project: alien4cloud-master File: AlienUtils.java View source code |
/**
* Get an element from the map (that can be null) or throw a NotFoundException if the element is not in the map.
*
* @param map The map from which to get the element or null.
* @param key The key of the element.
* @param message The error message for the not found exception. The message supports same formatting as logs "This is message {}", "message".
* @param args The arguments for the message formatting.
* @param <K> The type of map keys
* @param <K> The type of map values
* @return A non null element.
*/
public static <K, V> V getOrFail(Map<K, V> map, K key, String message, Object... args) {
if (map == null) {
FormattingTuple ft = MessageFormatter.arrayFormat(message, args);
throw new NotFoundException(ft.getMessage());
}
V value = map.get(key);
if (value == null) {
FormattingTuple ft = MessageFormatter.arrayFormat(message, args);
throw new NotFoundException(ft.getMessage());
}
return value;
}Example 4
| Project: citrus-tool-master File: IdeaLoggerAdapter.java View source code |
public void log(Marker marker, String callerFQCN, int level, String msg, Object[] argArray, Throwable t) {
FormattingTuple ft = MessageFormatter.arrayFormat(msg, argArray);
switch(level) {
case LocationAwareLogger.TRACE_INT:
if (logger.isDebugEnabled()) {
logger.debug(ft.getMessage(), ft.getThrowable());
}
break;
case LocationAwareLogger.DEBUG_INT:
if (logger.isDebugEnabled()) {
logger.debug(ft.getMessage(), ft.getThrowable());
}
break;
case LocationAwareLogger.INFO_INT:
logger.info(ft.getMessage(), ft.getThrowable());
break;
case LocationAwareLogger.WARN_INT:
logger.warn(ft.getMessage(), ft.getThrowable());
break;
case LocationAwareLogger.ERROR_INT:
logger.error(ft.getMessage(), ft.getThrowable());
break;
default:
throw new IllegalStateException("Level number " + level + " is not recognized.");
}
}Example 5
| Project: gemini.web.gemini-web-container-master File: WebBundleScannerTests.java View source code |
private void setExpectationsIncludingNestedJars(WebBundleScannerCallback callback) {
setExpectations(callback);
callback.classFound("org/slf4j/ILoggerFactory.class");
callback.classFound("org/slf4j/IMarkerFactory.class");
callback.classFound("org/slf4j/Logger.class");
callback.classFound("org/slf4j/LoggerFactory.class");
callback.classFound("org/slf4j/Marker.class");
callback.classFound("org/slf4j/MarkerFactory.class");
callback.classFound("org/slf4j/MDC.class");
callback.classFound("org/slf4j/helpers/BasicMarker.class");
callback.classFound("org/slf4j/helpers/BasicMarkerFactory.class");
callback.classFound("org/slf4j/helpers/BasicMDCAdapter.class");
callback.classFound("org/slf4j/helpers/FormattingTuple.class");
callback.classFound("org/slf4j/helpers/MarkerIgnoringBase.class");
callback.classFound("org/slf4j/helpers/MessageFormatter.class");
callback.classFound("org/slf4j/helpers/NamedLoggerBase.class");
callback.classFound("org/slf4j/helpers/NOPLogger.class");
callback.classFound("org/slf4j/helpers/NOPLoggerFactory.class");
callback.classFound("org/slf4j/helpers/NOPMDCAdapter.class");
callback.classFound("org/slf4j/helpers/SubstituteLoggerFactory.class");
callback.classFound("org/slf4j/helpers/Util.class");
callback.classFound("org/slf4j/spi/LocationAwareLogger.class");
callback.classFound("org/slf4j/spi/LoggerFactoryBinder.class");
callback.classFound("org/slf4j/spi/MarkerFactoryBinder.class");
callback.classFound("org/slf4j/spi/MDCAdapter.class");
}Example 6
| Project: javasec-master File: RmProjectHelper.java View source code |
/**
* 手动记录日志进入数�库,适用于记录��的业务日志
*
* @param action_module 日志模å?—å??
* @param content 日志内容
*/
public static void log(String action_module, String format, Object... arguments) {
String message = null;
if (arguments.length > 0) {
FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
message = ft.getMessage();
} else {
message = format;
}
//system businessLog begin
StackTraceElement[] sts = Thread.currentThread().getStackTrace();
String callMethodName = null;
boolean findSelfMethod = false;
for (int i = 0; i < sts.length; i++) {
//倒�查找
StackTraceElement st = sts[i];
if (RmProjectHelper.class.getName().equals(st.getClassName()) && "log".equals(st.getMethodName())) {
findSelfMethod = true;
} else if (findSelfMethod) {
//如果RmProjectHelper的上一层是RmLogHelper,则�往上�一层�是业务方法
if (RmLogHelper.class.getName().equals(st.getClassName()) && "log".equals(st.getMethodName()) && sts.length > i + 1) {
callMethodName = sts[i + 1].getMethodName();
} else {
callMethodName = st.getMethodName();
}
break;
}
}
String uuid = RmGlobalMonitor.uniqueUUID.get();
RmLogVo logVo = new RmLogVo();
{
//�始化logVo
//时间戳
logVo.setAction_date(RmDateHelper.getSysTimestamp());
//从request䏿³¨å€¼
HttpServletRequest request = RmRequestMonitor.getCurrentThreadRequest();
if (request != null) {
logVo.setAction_ip(RmProjectHelper.getIp(request));
RmUserVo userVo = RmProjectHelper.getRmUserVo(request);
if (userVo != null) {
logVo.setUser_id(userVo.getId());
logVo.setUser_id_name(userVo.getName());
logVo.setOwner_org_id(userVo.getParty_id_org());
}
}
logVo.setAction_module(action_module);
//智能匹�日志类型
{
logVo.setLog_type_id(RmLogTypeCache.getSingleton().matchLogType(action_module).getId());
}
//自动匹��作类型
{
logVo.setAction_type(getActionType(callMethodName));
}
logVo.setAction_uuid(uuid);
logVo.setContent(message);
}
insertDbLog(logVo);
//system businessLog end
}Example 7
| Project: JFramework-master File: TestReporter.java View source code |
//todo: method documentation
public void step(final float stepNo, final String format, final Object... argArray) {
if (logger.isInfoEnabled()) {
FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
DecimalFormat df = new DecimalFormat();
df.setMaximumFractionDigits(3);
final String FMT = "[STEP:%s] - %s";
logMessage(Level.INFO_INT, String.format(FMT, df.format(stepNo), ft.getMessage()));
}
}Example 8
| Project: liferay-portal-master File: LiferayLoggerAdapter.java View source code |
@Override
public void log(Marker marker, String fqcn, int level, String message, Object[] arguments, Throwable t) {
FormattingTuple formattingTuple = MessageFormatter.arrayFormat(message, arguments);
switch(level) {
case LocationAwareLogger.DEBUG_INT:
_log.debug(formattingTuple.getMessage(), t);
break;
case LocationAwareLogger.ERROR_INT:
_log.error(formattingTuple.getMessage(), t);
break;
case LocationAwareLogger.INFO_INT:
_log.info(formattingTuple.getMessage(), t);
break;
case LocationAwareLogger.TRACE_INT:
_log.trace(formattingTuple.getMessage(), t);
break;
case LocationAwareLogger.WARN_INT:
_log.warn(formattingTuple.getMessage(), t);
break;
default:
_log.info(formattingTuple.getMessage(), t);
}
}Example 9
| Project: mut4j-master File: LoggerWrapper.java View source code |
/**
* Delegate to the appropriate method of the underlying logger.
*/
public void debug(String format, Object[] argArray) {
if (!logger.isDebugEnabled())
return;
if (instanceofLAL) {
FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.DEBUG_INT, ft.getMessage(), ft.getArgArray(), ft.getThrowable());
} else {
logger.debug(format, argArray);
}
}Example 10
| Project: Prendamigo-master File: LoggerWrapper.java View source code |
/**
* Delegate to the appropriate method of the underlying logger.
*/
public void debug(String format, Object[] argArray) {
if (!logger.isDebugEnabled())
return;
if (instanceofLAL) {
FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.DEBUG_INT, ft.getMessage(), ft.getArgArray(), ft.getThrowable());
} else {
logger.debug(format, argArray);
}
}Example 11
| Project: slf4j-master File: LoggerWrapper.java View source code |
/**
* Delegate to the appropriate method of the underlying logger.
*/
public void debug(String format, Object... argArray) {
if (!logger.isDebugEnabled())
return;
if (instanceofLAL) {
FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.DEBUG_INT, ft.getMessage(), ft.getArgArray(), ft.getThrowable());
} else {
logger.debug(format, argArray);
}
}Example 12
| Project: spudplayer-master File: LoggerWrapper.java View source code |
/**
* Delegate to the appropriate method of the underlying logger.
*/
public void debug(String format, Object[] argArray) {
if (!logger.isDebugEnabled())
return;
if (instanceofLAL) {
FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.DEBUG_INT, ft.getMessage(), ft.getArgArray(), ft.getThrowable());
} else {
logger.debug(format, argArray);
}
}Example 13
| Project: constellio-master File: ConstellioJettyAwareLogger.java View source code |
private void log(Marker marker, int level, String msg, Object[] argArray, Throwable t) {
if (argArray == null) {
// Simple SLF4J Message (no args)
_logger.log(marker, FQCN, level, msg, null, t);
} else {
int loggerLevel = _logger.isTraceEnabled() ? TRACE : _logger.isDebugEnabled() ? DEBUG : _logger.isInfoEnabled() ? INFO : _logger.isWarnEnabled() ? WARN : ERROR;
if (loggerLevel <= level) {
// Don't assume downstream handles argArray properly.
// Do it the SLF4J way here to eliminate that as a bug.
FormattingTuple ft = MessageFormatter.arrayFormat(msg, argArray);
_logger.log(marker, FQCN, level, ft.getMessage(), null, t);
}
}
}Example 14
| Project: jetty-plugin-support-master File: JettyAwareLogger.java View source code |
private void log(Marker marker, int level, String msg, Object[] argArray, Throwable t) {
if (argArray == null) {
// Simple SLF4J Message (no args)
_logger.log(marker, FQCN, level, msg, null, t);
} else {
int loggerLevel = _logger.isTraceEnabled() ? TRACE : _logger.isDebugEnabled() ? DEBUG : _logger.isInfoEnabled() ? INFO : _logger.isWarnEnabled() ? WARN : ERROR;
if (loggerLevel <= level) {
// Don't assume downstream handles argArray properly.
// Do it the SLF4J way here to eliminate that as a bug.
FormattingTuple ft = MessageFormatter.arrayFormat(msg, argArray);
_logger.log(marker, FQCN, level, ft.getMessage(), null, t);
}
}
}Example 15
| Project: jetty-spdy-master File: JettyAwareLogger.java View source code |
private void log(Marker marker, int level, String msg, Object[] argArray, Throwable t) {
if (argArray == null) {
// Simple SLF4J Message (no args)
_logger.log(marker, FQCN, level, msg, null, t);
} else {
int loggerLevel = _logger.isTraceEnabled() ? TRACE : _logger.isDebugEnabled() ? DEBUG : _logger.isInfoEnabled() ? INFO : _logger.isWarnEnabled() ? WARN : ERROR;
if (loggerLevel <= level) {
// Don't assume downstream handles argArray properly.
// Do it the SLF4J way here to eliminate that as a bug.
FormattingTuple ft = MessageFormatter.arrayFormat(msg, argArray);
_logger.log(marker, FQCN, level, ft.getMessage(), null, t);
}
}
}Example 16
| Project: jetty.project-master File: JettyAwareLogger.java View source code |
private void log(Marker marker, int level, String msg, Object[] argArray, Throwable t) {
if (argArray == null) {
// Simple SLF4J Message (no args)
_logger.log(marker, FQCN, level, msg, null, t);
} else {
int loggerLevel = _logger.isTraceEnabled() ? TRACE : _logger.isDebugEnabled() ? DEBUG : _logger.isInfoEnabled() ? INFO : _logger.isWarnEnabled() ? WARN : ERROR;
if (loggerLevel <= level) {
// Don't assume downstream handles argArray properly.
// Do it the SLF4J way here to eliminate that as a bug.
FormattingTuple ft = MessageFormatter.arrayFormat(msg, argArray);
_logger.log(marker, FQCN, level, ft.getMessage(), null, t);
}
}
}Example 17
| Project: org.ops4j.pax.logging-master File: Slf4jLogger.java View source code |
/**
* This method implements LocationAwareLogger.log
*
* The caller passes in it's own Fully Qualified Class Name (fqcn).
*
* @param marker
* @param fqcn the fully qualified class name (FQCN) of the <b>caller</b>
* @param level Integer representation of the log level as defined in LocationAwareLogger
* @param message the message as a format string
* @param argArray an array of arguments to use in the message format string
* @param t the throwable to log
*/
public void log(Marker marker, String fqcn, int level, String message, Object[] argArray, Throwable t) {
setMDCMarker(marker);
switch(level) {
case (TRACE_INT):
if (m_delegate.isTraceEnabled()) {
FormattingTuple tuple = MessageFormatter.arrayFormat(message, argArray);
m_delegate.trace(tuple.getMessage(), t, fqcn);
}
break;
case (DEBUG_INT):
if (m_delegate.isDebugEnabled()) {
FormattingTuple tuple = MessageFormatter.arrayFormat(message, argArray);
m_delegate.debug(tuple.getMessage(), t, fqcn);
}
break;
case (INFO_INT):
if (m_delegate.isInfoEnabled()) {
FormattingTuple tuple = MessageFormatter.arrayFormat(message, argArray);
m_delegate.inform(tuple.getMessage(), t, fqcn);
}
break;
case (WARN_INT):
if (m_delegate.isWarnEnabled()) {
FormattingTuple tuple = MessageFormatter.arrayFormat(message, argArray);
m_delegate.warn(tuple.getMessage(), t, fqcn);
}
break;
case (ERROR_INT):
if (m_delegate.isErrorEnabled()) {
FormattingTuple tuple = MessageFormatter.arrayFormat(message, argArray);
m_delegate.error(tuple.getMessage(), t, fqcn);
}
break;
default:
break;
}
resetMDCMarker();
}Example 18
| Project: spring-open-master File: RestErrorFormatter.java View source code |
/**
* Takes a RestErrorCatalogEntry template and formats the description using a supplied
* list of replacement parameters.
*
* @param error the RestErrorCatalogEntry to format
* @param parameters parameter list to use as positional parameters in the
* result string
*
* @return the String object for the formatted message.
*/
static String formatErrorMessage(final RestErrorCatalogEntry error, final Object... parameters) {
final FormattingTuple formattingResult = MessageFormatter.arrayFormat(error.getDescriptionFormatString(), parameters);
return formattingResult.getMessage();
}Example 19
| Project: b2-master File: RecordingLogger.java View source code |
private void formatAndLog(String level, String format, Object... argArray) {
FormattingTuple tuple = MessageFormatter.arrayFormat(format, argArray);
log(level, tuple.getMessage(), null);
}Example 20
| Project: che-master File: GwtLoggerSlf4jBackend.java View source code |
private void formatAndLog(Level level, String format, Object... argArray) {
if (logger.isLoggable(level)) {
FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
logger.log(level, ft.getMessage(), ft.getThrowable());
}
}Example 21
| Project: cpool-master File: FanLogger.java View source code |
private void formatAndLog(LogLevel level, String format, Object arg1, Object arg2) {
if (!isLevelEnabled(level)) {
return;
}
FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
log(level, tp.getMessage(), tp.getThrowable());
}Example 22
| Project: deadcode4j-master File: LoggerForMavenLog.java View source code |
private void doDebug(FormattingTuple tuple) {
doDebug(tuple.getMessage(), tuple.getThrowable());
}Example 23
| Project: DevTools-master File: GwtLoggerSlf4jBackend.java View source code |
private void formatAndLog(Level level, String format, Object... argArray) {
if (logger.isLoggable(level)) {
FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
logger.log(level, ft.getMessage(), ft.getThrowable());
}
}Example 24
| Project: ef-orm-master File: AbstractLogger.java View source code |
public void debug(String s, Object obj) {
if (this.isDebugEnabled()) {
FormattingTuple f = MessageFormatter.format(s, obj);
log(StringUtils.toString(f.getMessage()));
}
}Example 25
| Project: LuaWars-master File: Log.java View source code |
private static void formatAndLog(LEVEL level, String format, Object arg1, Object arg2) {
if (currentLevel.compareTo(level) <= 0) {
FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
log(level, tp.getMessage(), tp.getThrowable());
}
}Example 26
| Project: slf4j-gwt-master File: GWTLoggerAdapter.java View source code |
private void formatAndLog(Level level, String format, Object... argArray) {
if (logger.isLoggable(level)) {
FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
logger.log(level, ft.getMessage(), ft.getThrowable());
}
}Example 27
| Project: xmvn-master File: IvyLoggerAdapter.java View source code |
private String formatMessage(String format, Object arg1, Object arg2) {
FormattingTuple tuple = MessageFormatter.format(format, arg1, arg2);
return formatMessage(tuple.getMessage(), tuple.getThrowable());
}Example 28
| Project: cleverbus-master File: Log.java View source code |
public static void debug(String message, Throwable t, Object... values) {
if (isDebugEnabled()) {
FormattingTuple ft = MessageFormatter.arrayFormat(message, values);
LoggerFactory.getLogger(getLogger()).debug(ft.getMessage(), t);
}
}Example 29
| Project: DependencyCheck-master File: AntLoggerAdapter.java View source code |
@Override
public void trace(String format, Object arg) {
if (task != null) {
final FormattingTuple tp = MessageFormatter.format(format, arg);
task.log(tp.getMessage(), Project.MSG_VERBOSE);
}
}Example 30
| Project: everBeen-master File: TaskLoggerBase.java View source code |
private void formatAndLog(LogLevel level, String format, Object arg1, Object arg2) {
if (!isLevelEnabled(level)) {
return;
}
FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
log(level.ordinal(), tp.getMessage(), tp.getThrowable());
}Example 31
| Project: grains-master File: MavenLoggerFactory.java View source code |
private void debug(FormattingTuple result) {
debug(result.getMessage(), result.getThrowable());
}Example 32
| Project: hive-master File: TestLogger.java View source code |
@Override
public void trace(String format, Object arg) {
FormattingTuple ft = MessageFormatter.format(format, arg);
log(LEVEL.TRACE, ft.getMessage(), ft.getThrowable());
}Example 33
| Project: jPOS-master File: JPOSLogger.java View source code |
@Override
public void trace(String format, Object arg) {
if (isTraceEnabled()) {
FormattingTuple ft = MessageFormatter.format(format, arg);
log.trace(ft.getMessage());
}
}Example 34
| Project: killbill-master File: SpyLogger.java View source code |
private void formatAndSave(String logLevel, String format, Object arg1, Object arg2) {
FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
save(logLevel, tp.getMessage(), tp.getThrowable());
}Example 35
| Project: slf4j-timber-master File: TimberLoggerAdapter.java View source code |
private void formatAndLog(LogType logType, String format, Object... argArray) {
FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
log(logType, ft.getMessage(), ft.getThrowable());
}Example 36
| Project: turmeric-releng-master File: JulLogger.java View source code |
private void formattedLog(Level level, String format, Object... args) {
if (!logger.isLoggable(level)) {
return;
}
FormattingTuple msg = MessageFormatter.format(format, args);
log(level, msg.getMessage(), null);
}Example 37
| Project: utils4maven-master File: MavenLoggerAdapter.java View source code |
/**
* Format with one object.
*
* @param format
* Format to use
* @param arg
* One argument
* @return The message
*/
private String format(final String format, final Object arg) {
final FormattingTuple tuple = MessageFormatter.format(format, arg);
return tuple.getMessage();
}Example 38
| Project: Chronicle-Logger-master File: ChronicleLogger.java View source code |
@Override
protected void append(ChronicleLogLevel level, String message, Object[] args) {
if (isLevelEnabled(level)) {
FormattingTuple tuple = MessageFormatter.arrayFormat(message, args);
writer.write(level, System.currentTimeMillis(), Thread.currentThread().getName(), name, tuple.getMessage(), tuple.getThrowable());
}
}Example 39
| Project: gradle-master File: OutputEventListenerBackedLogger.java View source code |
private void log(LogLevel logLevel, Throwable throwable, String format, Object[] args) {
FormattingTuple tuple = MessageFormatter.arrayFormat(format, args);
Throwable loggedThrowable = throwable == null ? tuple.getThrowable() : throwable;
log(logLevel, loggedThrowable, tuple.getMessage());
}Example 40
| Project: install4j-support-master File: Install4jLogger.java View source code |
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());
}Example 41
| Project: Path-Computation-Element-Emulator-master File: PceeLogger.java View source code |
private void log(LogLevelEnum level, String arg0, Object arg1) {
FormattingTuple tp = MessageFormatter.format(arg0, arg1);
log(level, tp.getMessage(), tp.getThrowable());
}Example 42
| Project: slf4j-jboss-logmanager-master File: Slf4jLogger.java View source code |
@Override
public void trace(final String format, final Object arg) {
if (ALT_TRACE_INT < logger.getEffectiveLevel()) {
return;
}
final FormattingTuple formattingTuple = MessageFormatter.format(format, arg);
log(org.jboss.logmanager.Level.TRACE, formattingTuple.getMessage(), formattingTuple.getThrowable());
}Example 43
| Project: cayenne-master File: ModelerLogger.java View source code |
private void consoleLog(byte level, String format, Object... arguments) {
if (this.isLevelEnabled(level)) {
FormattingTuple tuple = MessageFormatter.arrayFormat(format, arguments);
this.consoleLog(level, tuple.getMessage(), tuple.getThrowable());
}
}Example 44
| Project: fullsync-master File: FullSyncLogger.java View source code |
/**
* For formatted messages, first substitute arguments and then log.
*
* @param level
* @param format
* @param param1
* @param param2
*/
private void formatAndLog(final String level, final String format, final Object arg1, final Object arg2) {
final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
log(level, tp.getMessage(), tp.getThrowable());
}Example 45
| Project: show-java-master File: SystemOutLoggerAdapter.java View source code |
private void formatAndLog(int priority, String format, Object... argArray) {
if (isLoggable(priority)) {
FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
logInternal(priority, ft.getMessage(), ft.getThrowable());
}
}Example 46
| Project: acs-master File: JDK14LoggerAdapter.java View source code |
/**
* Log a message at level FINEST according to the specified format and
* argument.
*
* <p>
* This form avoids superfluous object creation when the logger is disabled
* for level FINEST.
* </p>
*
* @param format
* the format string
* @param arg
* the argument
*/
public void trace(String format, Object arg) {
if (logger.isLoggable(Level.FINEST)) {
FormattingTuple ft = MessageFormatter.format(format, arg);
log(SELF, Level.FINEST, ft.getMessage(), ft.getThrowable());
}
}Example 47
| Project: maven-custom-logging-master File: SimpleLogger.java View source code |
/**
* 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());
}Example 48
| Project: slf4j-android-logger-master File: AndroidLoggerAdapter.java View source code |
private void formatAndLog(final LogLevel logLevel, final String format, final Object... argArray) {
if (isLevelEnabled(logLevel)) {
final FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
log(logLevel, ft.getMessage(), ft.getThrowable());
}
}