Package org.slf4j.spi
Class NOPLoggingEventBuilder
java.lang.Object
org.slf4j.spi.NOPLoggingEventBuilder
- All Implemented Interfaces:
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. invalid input: '<'/p
- Since:
- 2.0.0
- Author:
- Ceki Gülcü
-
Method Summary
Modifier and TypeMethodDescriptionAdd an argument to the event being built.addArgument
(Supplier<?> objectSupplier) Add an argument supplier to the event being built.addKeyValue
(String key, Object value) Add akey value pair
to the event being built.addKeyValue
(String key, Supplier<Object> value) Add akey value pair
to the event being built.Amarker
to the event being built.void
log()
After the logging event is built, performs actual logging.void
Equivalent to callingLoggingEventBuilder.setMessage(String)
followed byLoggingEventBuilder.log()
;void
Equivalent to callingLoggingEventBuilder.setMessage(String)
followed byLoggingEventBuilder.addArgument(Object)
} and thenLoggingEventBuilder.log()
void
Equivalent to callingLoggingEventBuilder.setMessage(String)
followed by zero or more calls toLoggingEventBuilder.addArgument(Object)
(depending on the size of args array) and thenLoggingEventBuilder.log()
void
Equivalent to callingLoggingEventBuilder.setMessage(String)
followed by two calls toLoggingEventBuilder.addArgument(Object)
and thenLoggingEventBuilder.log()
void
Equivalent to callingLoggingEventBuilder.setMessage(Supplier)
followed byLoggingEventBuilder.log()
Set the cause for the logging event being built.setMessage
(String message) Sets the message of the logging event.setMessage
(Supplier<String> messageSupplier) Sets the message of the event via a message supplier.static LoggingEventBuilder
Returns the singleton instance of this class.
-
Method Details
-
singleton
Returns the singleton instance of this class. Used by
makeLoggingEventBuilder(Level)
.- Returns:
- the singleton instance of this class
-
addMarker
Description copied from interface:LoggingEventBuilder
Amarker
to the event being built.- Specified by:
addMarker
in interfaceLoggingEventBuilder
- Parameters:
marker
- a Marker instance to add.- Returns:
- a LoggingEventBuilder, usually this.
-
addArgument
Description copied from interface:LoggingEventBuilder
Add an argument to the event being built.- Specified by:
addArgument
in interfaceLoggingEventBuilder
- Parameters:
p
- an Object to add.- Returns:
- a LoggingEventBuilder, usually this.
-
addArgument
Description copied from interface:LoggingEventBuilder
Add an argument supplier to the event being built.- Specified by:
addArgument
in interfaceLoggingEventBuilder
- Parameters:
objectSupplier
- an Object supplier to add.- Returns:
- a LoggingEventBuilder, usually this.
-
addKeyValue
Description copied from interface:LoggingEventBuilder
Add akey value pair
to the event being built.- Specified by:
addKeyValue
in interfaceLoggingEventBuilder
- Parameters:
key
- the key of the key value pair.value
- the value of the key value pair.- Returns:
- a LoggingEventBuilder, usually this.
-
addKeyValue
Description copied from interface:LoggingEventBuilder
Add akey value pair
to the event being built.- Specified by:
addKeyValue
in interfaceLoggingEventBuilder
- Parameters:
key
- the key of the key value pair.value
- a supplier of a value for the key value pair.- Returns:
- a LoggingEventBuilder, usually this.
-
setCause
Description copied from interface:LoggingEventBuilder
Set the cause for the logging event being built.- Specified by:
setCause
in interfaceLoggingEventBuilder
- Parameters:
cause
- a throwable- Returns:
- a LoggingEventBuilder, usually this.
-
log
Description copied from interface:LoggingEventBuilder
After the logging event is built, performs actual logging. This method must be called for logging to occur. If the call toLoggingEventBuilder.log()
is omitted, aLoggingEvent
will be built but no logging will occur.- Specified by:
log
in interfaceLoggingEventBuilder
-
setMessage
Description copied from interface:LoggingEventBuilder
Sets the message of the logging event.- Specified by:
setMessage
in interfaceLoggingEventBuilder
-
setMessage
Description copied from interface:LoggingEventBuilder
Sets the message of the event via a message supplier.- Specified by:
setMessage
in interfaceLoggingEventBuilder
- Parameters:
messageSupplier
- supplies a String to be used as the message for the event
-
log
Description copied from interface:LoggingEventBuilder
Equivalent to callingLoggingEventBuilder.setMessage(String)
followed byLoggingEventBuilder.log()
;- Specified by:
log
in interfaceLoggingEventBuilder
- Parameters:
message
- the message to log
-
log
Description copied from interface:LoggingEventBuilder
Equivalent to callingLoggingEventBuilder.setMessage(Supplier)
followed byLoggingEventBuilder.log()
- Specified by:
log
in interfaceLoggingEventBuilder
- Parameters:
messageSupplier
- a Supplier returning a message of type String
-
log
Description copied from interface:LoggingEventBuilder
Equivalent to callingLoggingEventBuilder.setMessage(String)
followed byLoggingEventBuilder.addArgument(Object)
} and thenLoggingEventBuilder.log()
- Specified by:
log
in interfaceLoggingEventBuilder
- Parameters:
message
- the message to logarg
- an argument to be used with the message to log
-
log
Description copied from interface:LoggingEventBuilder
Equivalent to callingLoggingEventBuilder.setMessage(String)
followed by two calls toLoggingEventBuilder.addArgument(Object)
and thenLoggingEventBuilder.log()
- Specified by:
log
in interfaceLoggingEventBuilder
- Parameters:
message
- the message to logarg0
- first argument to be used with the message to logarg1
- second argument to be used with the message to log
-
log
Description copied from interface:LoggingEventBuilder
Equivalent to callingLoggingEventBuilder.setMessage(String)
followed by zero or more calls toLoggingEventBuilder.addArgument(Object)
(depending on the size of args array) and thenLoggingEventBuilder.log()
- Specified by:
log
in interfaceLoggingEventBuilder
- Parameters:
message
- the message to logargs
- a list (actually an array) of arguments to be used with the message to log
-