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)
LoggingEventBuilder
marker
to the event being built.addMarker
in interface LoggingEventBuilder
marker
- a Marker instance to add.public LoggingEventBuilder addArgument(Object p)
LoggingEventBuilder
addArgument
in interface LoggingEventBuilder
p
- an Object to add.public LoggingEventBuilder addArgument(Supplier<?> objectSupplier)
LoggingEventBuilder
addArgument
in interface LoggingEventBuilder
objectSupplier
- an Object supplier to add.public LoggingEventBuilder addKeyValue(String key, Object value)
LoggingEventBuilder
key value pair
to the event being built.addKeyValue
in interface LoggingEventBuilder
key
- the key of the key value pair.value
- the value of the key value pair.public LoggingEventBuilder addKeyValue(String key, Supplier<Object> value)
LoggingEventBuilder
key value pair
to the event being built.addKeyValue
in interface LoggingEventBuilder
key
- the key of the key value pair.value
- a supplier of a value for the key value pair.public LoggingEventBuilder setCause(Throwable cause)
LoggingEventBuilder
setCause
in interface LoggingEventBuilder
cause
- a throwablepublic void log()
LoggingEventBuilder
LoggingEventBuilder.log()
is omitted, a LoggingEvent
will be built but no logging will occur.log
in interface LoggingEventBuilder
public LoggingEventBuilder setMessage(String message)
LoggingEventBuilder
setMessage
in interface LoggingEventBuilder
public LoggingEventBuilder setMessage(Supplier<String> messageSupplier)
LoggingEventBuilder
setMessage
in interface LoggingEventBuilder
messageSupplier
- supplies a String to be used as the message for the eventpublic void log(String message)
LoggingEventBuilder
LoggingEventBuilder.setMessage(String)
followed by LoggingEventBuilder.log()
;log
in interface LoggingEventBuilder
message
- the message to logpublic void log(Supplier<String> messageSupplier)
LoggingEventBuilder
LoggingEventBuilder.setMessage(Supplier)
followed by LoggingEventBuilder.log()
log
in interface LoggingEventBuilder
messageSupplier
- a Supplier returning a message of type Stringpublic void log(String message, Object arg)
LoggingEventBuilder
LoggingEventBuilder.setMessage(String)
followed by LoggingEventBuilder.addArgument(Object)
}
and then LoggingEventBuilder.log()
log
in interface LoggingEventBuilder
message
- the message to logarg
- an argument to be used with the message to logpublic void log(String message, Object arg0, Object arg1)
LoggingEventBuilder
LoggingEventBuilder.setMessage(String)
followed by two calls to
LoggingEventBuilder.addArgument(Object)
and then LoggingEventBuilder.log()
log
in interface LoggingEventBuilder
message
- 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)
LoggingEventBuilder
LoggingEventBuilder.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 LoggingEventBuilder
message
- 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.