本文整理匯總了Java中org.slf4j.helpers.FormattingTuple.getThrowable方法的典型用法代碼示例。如果您正苦於以下問題:Java FormattingTuple.getThrowable方法的具體用法?Java FormattingTuple.getThrowable怎麽用?Java FormattingTuple.getThrowable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.slf4j.helpers.FormattingTuple
的用法示例。
在下文中一共展示了FormattingTuple.getThrowable方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: eventToRecord
import org.slf4j.helpers.FormattingTuple; //導入方法依賴的package包/類
private LogRecord eventToRecord(LoggingEvent event, Level julLevel) {
String format = event.getMessage();
Object[] arguments = event.getArgumentArray();
FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
if (ft.getThrowable() != null && event.getThrowable() != null) {
throw new IllegalArgumentException("both last element in argument array and last argument are of type Throwable");
}
Throwable t = event.getThrowable();
if (ft.getThrowable() != null) {
t = ft.getThrowable();
throw new IllegalStateException("fix above code");
}
LogRecord record = new LogRecord(julLevel, ft.getMessage());
record.setLoggerName(event.getLoggerName());
record.setMillis(event.getTimeStamp());
record.setSourceClassName(EventConstants.NA_SUBST);
record.setSourceMethodName(EventConstants.NA_SUBST);
record.setThrown(t);
return record;
}
示例2: doLog
import org.slf4j.helpers.FormattingTuple; //導入方法依賴的package包/類
private void doLog(Level lvl, FormattingTuple tuple) {
if (tuple.getThrowable() == null) {
Utils.log(this.logger, 5, this.name, lvl, "%s", tuple.getMessage());
} else {
Utils.log(this.logger, 5, this.name, lvl, "%s: %s", tuple.getMessage(), Utils.toString(tuple.getThrowable()));
}
}
示例3: trace
import org.slf4j.helpers.FormattingTuple; //導入方法依賴的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());
}
}
示例4: debug
import org.slf4j.helpers.FormattingTuple; //導入方法依賴的package包/類
@Override
public void debug(final String format, final Object arg) {
final FormattingTuple ft = MessageFormatter.format(format, arg);
Crashlytics.log(Log.DEBUG, mTag, ft.getMessage());
if (ft.getThrowable() != null) {
exception(Log.DEBUG, ft.getThrowable());
}
}
示例5: info
import org.slf4j.helpers.FormattingTuple; //導入方法依賴的package包/類
@Override
public void info(final String format, final Object arg) {
final FormattingTuple ft = MessageFormatter.format(format, arg);
Crashlytics.log(Log.INFO, mTag, ft.getMessage());
if (ft.getThrowable() != null) {
exception(Log.INFO, ft.getThrowable());
}
}
示例6: warn
import org.slf4j.helpers.FormattingTuple; //導入方法依賴的package包/類
@Override
public void warn(final String format, final Object arg) {
final FormattingTuple ft = MessageFormatter.format(format, arg);
Crashlytics.log(Log.WARN, mTag, ft.getMessage());
if (ft.getThrowable() != null) {
exception(Log.WARN, ft.getThrowable());
}
}
示例7: error
import org.slf4j.helpers.FormattingTuple; //導入方法依賴的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());
}
}
示例8: add
import org.slf4j.helpers.FormattingTuple; //導入方法依賴的package包/類
private void add(Message.Level level, FormattingTuple tp) {
if (tp.getThrowable() == null) {
add(level, tp.getMessage());
} else {
add(level, tp.getMessage(), tp.getThrowable());
}
}
示例9: log
import org.slf4j.helpers.FormattingTuple; //導入方法依賴的package包/類
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());
}