本文整理匯總了Java中com.google.gwt.logging.impl.StackTracePrintStream類的典型用法代碼示例。如果您正苦於以下問題:Java StackTracePrintStream類的具體用法?Java StackTracePrintStream怎麽用?Java StackTracePrintStream使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StackTracePrintStream類屬於com.google.gwt.logging.impl包,在下文中一共展示了StackTracePrintStream類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: format
import com.google.gwt.logging.impl.StackTracePrintStream; //導入依賴的package包/類
@Override
public String format(LogRecord event) {
StringBuilder message = new StringBuilder();
Date date = new Date(event.getMillis());
message.append(dateFormat.format(date)).append("\t");
message.append(event.getLevel().getName()).append("\t");
if (event.getMessage() != null)
message.append(event.getMessage()).append("\t").append("\n");
if (event.getThrown() != null && showStackTraces) {
StringBuilder traceSOut = new StringBuilder();
event.getThrown().printStackTrace(new StackTracePrintStream(traceSOut));
message.append(traceSOut);
}
return message.toString();
}
示例2: getDetailString
import com.google.gwt.logging.impl.StackTracePrintStream; //導入依賴的package包/類
private String getDetailString(Throwable error) {
StringBuilder sb = new StringBuilder();
if (error instanceof CommandException) {
sb.append(((CommandException) error).getCauseMessage()).append(" : \n");
sb.append(((CommandException) error).getCauseStackTrace());
} else {
sb.append(error.getMessage()).append(" : \n");
error.printStackTrace(new StackTracePrintStream(sb));
}
return sb.toString();
}
示例3: doFormat
import com.google.gwt.logging.impl.StackTracePrintStream; //導入依賴的package包/類
private String doFormat(final LogRecord record) {
// TODO Once we have added real thread names in WebWorkers,
// We should output it here too.
String threadName = null;
try {
threadName = getThreadName(record);
} catch (final Exception e) {
// NOP
}
if ((threadName == null) || threadName.isEmpty()) {
threadName = "main";
}
final StringBuilder message = new StringBuilder();
final Date date = new Date(record.getMillis());
message.append(SystemUtils.utc(date));
message.append(" ");
message.append(record.getLevel().getName());
message.append(" ");
message.append(threadName);
message.append(" ");
message.append(record.getLoggerName());
message.append(" ");
message.append(record.getMessage());
final Throwable t = record.getThrown();
if (t != null) {
t.printStackTrace(new StackTracePrintStream(message));
}
return message.toString();
}