public interface Log
Modifier and Type | Interface and Description |
---|---|
static class |
Log.Level
The level of importance of a log entry.
|
Modifier and Type | Method and Description |
---|---|
static Log |
discardingLog() |
static Log |
forwardingLog(Log log)
Derive a log which defers to the given if available, or otherwise discards
the event.
|
static Log |
forwardingLog(java.util.function.Supplier<Log> logSupplier)
Derive a log which defers to the log obtained from the given supplier when
available, or otherwise discards the event.
|
void |
log(Log.Level level,
java.lang.String message)
Log a message.
|
void |
log(Log.Level level,
java.lang.String message,
java.lang.Throwable exception)
Log a message and an associated throwable.
|
void |
log(Log.Level level,
java.lang.Throwable exception)
Log a message and an associated throwable.
|
default Log |
mapLevel(Log.Level from,
Log.Level to)
Derive a log which defers to the receiver, after mapping events of level
from to events of level to . |
default Log |
mapMessage(java.util.function.Function<java.lang.String,java.lang.String> mapping)
Derive a log which defers to the receiver, after modifying the string message
according to the given function.
|
default Log |
mapThrowable(java.util.function.Function<java.lang.Throwable,java.lang.Throwable> mapping)
Derive a log which defers to the receiver, after modifying the throwable
according to the given function where relevant.
|
static Log |
simpleLog(java.util.function.BiConsumer<Log.Level,java.lang.String> action)
Create a simple log which derives messages according to exceptions and
otherwise discards exception information.
|
static Log |
simpleLog(java.util.function.Consumer<java.lang.String> action)
Create a simple log which derives messages according to levels and exceptions
and otherwise discards level and exception information.
|
void log(Log.Level level, java.lang.String message)
level
- The importance level of the given messagemessage
- The message to logvoid log(Log.Level level, java.lang.String message, java.lang.Throwable exception)
level
- The importance level of the given messagemessage
- The message to logexception
- The exception associated with the messagevoid log(Log.Level level, java.lang.Throwable exception)
level
- The importance level of the given messageexception
- The exception associated with the messagestatic Log simpleLog(java.util.function.BiConsumer<Log.Level,java.lang.String> action)
action
- the action upon receiving the level and derived message string for a
log eventstatic Log simpleLog(java.util.function.Consumer<java.lang.String> action)
action
- the action upon receiving the derived message string for a log eventstatic Log forwardingLog(Log log)
log
- a nullable reference to a log instancestatic Log forwardingLog(java.util.function.Supplier<Log> logSupplier)
logSupplier
- an supplier which may be able to find a log to defer tostatic Log discardingLog()
default Log mapMessage(java.util.function.Function<java.lang.String,java.lang.String> mapping)
mapping
- the mapping function to modify the message stringsdefault Log mapLevel(Log.Level from, Log.Level to)
from
to events of level to
.from
- the level to map fromto
- the level to map todefault Log mapThrowable(java.util.function.Function<java.lang.Throwable,java.lang.Throwable> mapping)
mapping
- the mapping function to modify the logged exceptions