public interface LogWriter
LogWriter.
This interface provides all the common logging methods used at runtime.
| Modifier and Type | Method and Description |
|---|---|
void |
batch(java.util.function.Consumer<LogWriter> fn)
Write a set of log messages in a batch.
|
default void |
log(java.lang.CharSequence message)
Log a message.
|
default void |
log(java.lang.CharSequence message,
java.lang.Throwable cause)
Log a message and exception at level.
|
void |
log(LogMessage message)
Log a
LogMessage. |
void |
log(LogMessage message,
java.lang.Throwable cause)
Log a message and exception.
|
default void |
log(java.lang.String pattern,
java.lang.Object... args)
Log a pattern formatted message.
|
default void |
log(java.util.function.Supplier<? extends java.lang.CharSequence> messageSupplier)
Log the supplied message.
|
default void |
log(java.util.function.Supplier<? extends java.lang.CharSequence> messageSupplier,
java.lang.Throwable cause)
Log the supplied message and exception.
|
default void |
logf(java.lang.String format,
java.lang.Object... args)
Log a string formatted message.
|
static LogWriter |
nullWriter() |
static LogWriter nullWriter()
void log(LogMessage message)
LogMessage.message - The message to log.default void log(java.lang.CharSequence message)
message - A character sequence (or String).default void log(java.util.function.Supplier<? extends java.lang.CharSequence> messageSupplier)
messageSupplier - A Supplier for the message.void log(LogMessage message, java.lang.Throwable cause)
message - The message to log.cause - The exception to log.default void log(java.lang.CharSequence message,
java.lang.Throwable cause)
message - A character sequence (or String).cause - The exception to log.default void log(java.util.function.Supplier<? extends java.lang.CharSequence> messageSupplier,
java.lang.Throwable cause)
messageSupplier - A Supplier for the message.cause - The exception to log.default void log(java.lang.String pattern,
java.lang.Object... args)
log(LogMessage.patternFormat(pattern, args)), but some logging implementations may provide
a more efficient alternative.pattern - The format string, as per LogMessage.patternFormat(String, Object...).args - The format arguments.default void logf(java.lang.String format,
java.lang.Object... args)
log(LogMessage.stringFormat(format, args)), but some logging implementations may provide a
more efficient alternative.format - The format string, as per LogMessage.stringFormat(String, Object...).args - The format arguments.void batch(java.util.function.Consumer<LogWriter> fn)
The specified Consumer will be invoked with a LogWriter that collects all log output and then
writes them all consecutively when the consumer invocation returns. Use this when a set of log lines must appear
consecutively in the log, regardless of time ordering.
Note: most implementations do not guarantee log ordering, so log lines may not always be ordered correctly by timestamp. This is especially true when logs are written in batch.
fn - A Consumer that will be invoked with the batching LogWriter.