F - the LogFormatter typepublic class PrintStreamAppender<F extends LogFormatter> extends Object implements LogAppender<F>, IntConsumer
LogAppender that writes to a PrintStream.| Modifier and Type | Field and Description |
|---|---|
static PrintStream |
defaultOutput
Default output stream for
ConsoleLogger |
| Constructor and Description |
|---|
PrintStreamAppender(F formatter)
|
PrintStreamAppender(PrintStream stream,
F formatter)
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(int ch)
Output a single character.
|
void |
close()
Close the
PrintStreamAppender. |
static PrintStreamAppender<BasicFormatter> |
getBasic()
|
static PrintStreamAppender<BasicFormatter> |
getBasic(PrintStream stream)
|
F |
getFormatter()
Get the
LogFormatter used by this LogAppender. |
void |
output(long millis,
net.pwall.log.Logger logger,
net.pwall.log.Level level,
Object message,
Throwable throwable)
Output a log message.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitandThenpublic static final PrintStream defaultOutput
ConsoleLoggerpublic PrintStreamAppender(PrintStream stream, F formatter)
stream - the PrintStreamformatter - the LogFormatterpublic PrintStreamAppender(F formatter)
formatter - the LogFormatterpublic F getFormatter()
LogAppenderLogFormatter used by this LogAppender.getFormatter in interface LogAppender<F extends LogFormatter>LogFormatterpublic void output(long millis,
net.pwall.log.Logger logger,
net.pwall.log.Level level,
Object message,
Throwable throwable)
output in interface LogAppender<F extends LogFormatter>millis - the time of the event in milliseconds from the standard eralogger - the Loggerlevel - the Levelmessage - the messagethrowable - an optional Throwablepublic void accept(int ch)
IntConsumer interface required by the
LogFormatter.
When a newline is output, the function uses the PrintStream.println() function, which will cause the
operating-system-dependent form of line ending to be used (and will also flush the output).accept in interface IntConsumerch - the characterpublic void close()
PrintStreamAppender. Closes the underlying PrintStream. The appender does not check
whether the PrintStream has been closed, so attempts to use it after close() has been called will
result in unpredictable behaviour.close in interface AutoCloseableclose in interface LogAppender<F extends LogFormatter>public static PrintStreamAppender<BasicFormatter> getBasic(PrintStream stream)
stream - the PrintStreamPrintStreamAppenderpublic static PrintStreamAppender<BasicFormatter> getBasic()
PrintStreamAppenderCopyright © 2024. All rights reserved.