public class NOPLoggingEventBuilder extends Object implements LoggingEventBuilder
A no-operation implementation of LoggingEventBuilder.
As the name indicates, the method in this class do nothing, except when a return value is expected in which case a singleton, i.e. the unique instance of this class is returned.
| Modifier and Type | Method and Description |
|---|---|
LoggingEventBuilder |
addArgument(Object p)
Add an argument to the event being built.
|
LoggingEventBuilder |
addArgument(Supplier<?> objectSupplier)
Add an argument supplier to the event being built.
|
LoggingEventBuilder |
addKeyValue(String key,
Object value)
Add a
key value pair to the event being built. |
LoggingEventBuilder |
addKeyValue(String key,
Supplier<Object> value)
Add a
key value pair to the event being built. |
LoggingEventBuilder |
addMarker(Marker marker)
A
marker to the event being built. |
void |
log()
After the logging event is built, performs actual logging.
|
void |
log(String message)
Equivalent to calling
LoggingEventBuilder.setMessage(String) followed by LoggingEventBuilder.log(); |
void |
log(String message,
Object... args)
Equivalent to calling
LoggingEventBuilder.setMessage(String) followed by zero or more calls to
LoggingEventBuilder.addArgument(Object) (depending on the size of args array) and then LoggingEventBuilder.log() |
void |
log(String message,
Object arg)
Equivalent to calling
LoggingEventBuilder.setMessage(String) followed by LoggingEventBuilder.addArgument(Object)}
and then LoggingEventBuilder.log() |
void |
log(String message,
Object arg0,
Object arg1)
Equivalent to calling
LoggingEventBuilder.setMessage(String) followed by two calls to
LoggingEventBuilder.addArgument(Object) and then LoggingEventBuilder.log() |
void |
log(Supplier<String> messageSupplier)
Equivalent to calling
LoggingEventBuilder.setMessage(Supplier) followed by LoggingEventBuilder.log() |
LoggingEventBuilder |
setCause(Throwable cause)
Set the cause for the logging event being built.
|
LoggingEventBuilder |
setMessage(String message)
Sets the message of the logging event.
|
LoggingEventBuilder |
setMessage(Supplier<String> messageSupplier)
Sets the message of the event via a message supplier.
|
static LoggingEventBuilder |
singleton()
Returns the singleton instance of this class.
|
public static LoggingEventBuilder singleton()
Returns the singleton instance of this class.
Used by makeLoggingEventBuilder(Level).
public LoggingEventBuilder addMarker(Marker marker)
LoggingEventBuildermarker to the event being built.addMarker in interface LoggingEventBuildermarker - a Marker instance to add.public LoggingEventBuilder addArgument(Object p)
LoggingEventBuilderaddArgument in interface LoggingEventBuilderp - an Object to add.public LoggingEventBuilder addArgument(Supplier<?> objectSupplier)
LoggingEventBuilderaddArgument in interface LoggingEventBuilderobjectSupplier - an Object supplier to add.public LoggingEventBuilder addKeyValue(String key, Object value)
LoggingEventBuilderkey value pair to the event being built.addKeyValue in interface LoggingEventBuilderkey - the key of the key value pair.value - the value of the key value pair.public LoggingEventBuilder addKeyValue(String key, Supplier<Object> value)
LoggingEventBuilderkey value pair to the event being built.addKeyValue in interface LoggingEventBuilderkey - the key of the key value pair.value - a supplier of a value for the key value pair.public LoggingEventBuilder setCause(Throwable cause)
LoggingEventBuildersetCause in interface LoggingEventBuildercause - a throwablepublic void log()
LoggingEventBuilderLoggingEventBuilder.log() is omitted, a LoggingEvent
will be built but no logging will occur.log in interface LoggingEventBuilderpublic LoggingEventBuilder setMessage(String message)
LoggingEventBuildersetMessage in interface LoggingEventBuilderpublic LoggingEventBuilder setMessage(Supplier<String> messageSupplier)
LoggingEventBuildersetMessage in interface LoggingEventBuildermessageSupplier - supplies a String to be used as the message for the eventpublic void log(String message)
LoggingEventBuilderLoggingEventBuilder.setMessage(String) followed by LoggingEventBuilder.log();log in interface LoggingEventBuildermessage - the message to logpublic void log(Supplier<String> messageSupplier)
LoggingEventBuilderLoggingEventBuilder.setMessage(Supplier) followed by LoggingEventBuilder.log()log in interface LoggingEventBuildermessageSupplier - a Supplier returning a message of type Stringpublic void log(String message, Object arg)
LoggingEventBuilderLoggingEventBuilder.setMessage(String) followed by LoggingEventBuilder.addArgument(Object)}
and then LoggingEventBuilder.log()log in interface LoggingEventBuildermessage - the message to logarg - an argument to be used with the message to logpublic void log(String message, Object arg0, Object arg1)
LoggingEventBuilderLoggingEventBuilder.setMessage(String) followed by two calls to
LoggingEventBuilder.addArgument(Object) and then LoggingEventBuilder.log()log in interface LoggingEventBuildermessage - the message to logarg0 - first argument to be used with the message to logarg1 - second argument to be used with the message to logpublic void log(String message, Object... args)
LoggingEventBuilderLoggingEventBuilder.setMessage(String) followed by zero or more calls to
LoggingEventBuilder.addArgument(Object) (depending on the size of args array) and then LoggingEventBuilder.log()log in interface LoggingEventBuildermessage - the message to logargs - a list (actually an array) of arguments to be used with the message to logCopyright © 2005–2022 QOS.ch. All rights reserved.