本文整理了Java中jline.internal.Log.render()
方法的一些代码示例,展示了Log.render()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Log.render()
方法的具体详情如下:
包路径:jline.internal.Log
类名称:Log
方法名:render
[英]Helper to support rendering messages.
[中]帮助器以支持呈现消息。
代码示例来源:origin: jline/jline
static void logWithJul(Level level, Object... messages) {
Logger logger = Logger.getLogger("jline");
Throwable cause = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
for (int i = 0; i < messages.length; i++) {
// Special handling for the last message if its a throwable, render its stack on the next line
if (i + 1 == messages.length && messages[i] instanceof Throwable) {
cause = (Throwable) messages[i];
}
else {
render(ps, messages[i]);
}
}
ps.close();
LogRecord r = new LogRecord(toJulLevel(level), baos.toString());
r.setThrown(cause);
logger.log(r);
}
代码示例来源:origin: jline/jline
@TestAccessible
static void log(final Level level, final Object... messages) {
if (useJul) {
logWithJul(level, messages);
return;
}
//noinspection SynchronizeOnNonFinalField
synchronized (output) {
output.format("[%s] ", level);
for (int i=0; i<messages.length; i++) {
// Special handling for the last message if its a throwable, render its stack on the next line
if (i + 1 == messages.length && messages[i] instanceof Throwable) {
output.println();
((Throwable)messages[i]).printStackTrace(output);
}
else {
render(output, messages[i]);
}
}
output.println();
output.flush();
}
}
代码示例来源:origin: com.typesafe.sbt/incremental-compiler
static void logWithJul(Level level, Object... messages) {
Logger logger = Logger.getLogger("jline");
Throwable cause = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
for (int i = 0; i < messages.length; i++) {
// Special handling for the last message if its a throwable, render its stack on the next line
if (i + 1 == messages.length && messages[i] instanceof Throwable) {
cause = (Throwable) messages[i];
}
else {
render(ps, messages[i]);
}
}
ps.close();
LogRecord r = new LogRecord(toJulLevel(level), baos.toString());
r.setThrown(cause);
logger.log(r);
}
代码示例来源:origin: com.typesafe.sbt/incremental-compiler
@TestAccessible
static void log(final Level level, final Object... messages) {
if (useJul) {
logWithJul(level, messages);
return;
}
//noinspection SynchronizeOnNonFinalField
synchronized (output) {
output.format("[%s] ", level);
for (int i=0; i<messages.length; i++) {
// Special handling for the last message if its a throwable, render its stack on the next line
if (i + 1 == messages.length && messages[i] instanceof Throwable) {
output.println();
((Throwable)messages[i]).printStackTrace(output);
}
else {
render(output, messages[i]);
}
}
output.println();
output.flush();
}
}
内容来源于网络,如有侵权,请联系作者删除!