use of org.slf4j.helpers.FormattingTuple in project hive by apache.
the class TestLogger method debug.
@Override
public void debug(String format, Object arg) {
FormattingTuple ft = MessageFormatter.format(format, arg);
log(LEVEL.DEBUG, ft.getMessage(), ft.getThrowable());
}
use of org.slf4j.helpers.FormattingTuple in project hive by apache.
the class TestLogger method warn.
@Override
public void warn(String format, Object arg) {
FormattingTuple ft = MessageFormatter.format(format, arg);
log(LEVEL.WARN, ft.getMessage(), ft.getThrowable());
}
use of org.slf4j.helpers.FormattingTuple in project opennms by OpenNMS.
the class LogAdapter method format.
default String format(String message, Object... args) {
FormattingTuple tp = MessageFormatter.arrayFormat(message, args);
String formattedMessage = tp.getMessage();
return formattedMessage.replaceAll("%t", "\t").replaceAll("%n", "\n");
}
use of org.slf4j.helpers.FormattingTuple in project opennms by OpenNMS.
the class MockLogger method formatAndLog.
/**
* For formatted messages, first substitute arguments and then log.
*
* @param level
* @param format
* @param arg1
* @param arg2
*/
private void formatAndLog(Level level, String format, Object arg1, Object arg2) {
if (!isLevelEnabled(level)) {
return;
}
FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
log(level, tp.getMessage(), tp.getThrowable());
}
use of org.slf4j.helpers.FormattingTuple in project Javacord by BtoBastian.
the class JavacordLogger method error.
@Override
public final void error(String format, Object arg1, Object arg2) {
FormattingTuple ft = MessageFormatter.format(format, arg1, arg2);
LogRecord record = new LogRecord(Level.SEVERE, ft.getMessage());
record.setThrown(ft.getThrowable());
record.setLoggerName(name);
Logger.getLogger(name).log(record);
}
Aggregations