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 pairto the event being built.addKeyValue(String key, Supplier<Object> value) Add akey value pairto the event being built.Amarkerto the event being built.voidlog()After the logging event is built, performs actual logging.voidEquivalent to callingLoggingEventBuilder.setMessage(String)followed byLoggingEventBuilder.log();voidEquivalent to callingLoggingEventBuilder.setMessage(String)followed byLoggingEventBuilder.addArgument(Object)} and thenLoggingEventBuilder.log()voidEquivalent to callingLoggingEventBuilder.setMessage(String)followed by zero or more calls toLoggingEventBuilder.addArgument(Object)(depending on the size of args array) and thenLoggingEventBuilder.log()voidEquivalent to callingLoggingEventBuilder.setMessage(String)followed by two calls toLoggingEventBuilder.addArgument(Object)and thenLoggingEventBuilder.log()voidEquivalent 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 LoggingEventBuilderReturns 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:LoggingEventBuilderAmarkerto the event being built.- Specified by:
addMarkerin interfaceLoggingEventBuilder- Parameters:
marker- a Marker instance to add.- Returns:
- a LoggingEventBuilder, usually this.
-
addArgument
Description copied from interface:LoggingEventBuilderAdd an argument to the event being built.- Specified by:
addArgumentin interfaceLoggingEventBuilder- Parameters:
p- an Object to add.- Returns:
- a LoggingEventBuilder, usually this.
-
addArgument
Description copied from interface:LoggingEventBuilderAdd an argument supplier to the event being built.- Specified by:
addArgumentin interfaceLoggingEventBuilder- Parameters:
objectSupplier- an Object supplier to add.- Returns:
- a LoggingEventBuilder, usually this.
-
addKeyValue
Description copied from interface:LoggingEventBuilderAdd akey value pairto the event being built.- Specified by:
addKeyValuein 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:LoggingEventBuilderAdd akey value pairto the event being built.- Specified by:
addKeyValuein 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:LoggingEventBuilderSet the cause for the logging event being built.- Specified by:
setCausein interfaceLoggingEventBuilder- Parameters:
cause- a throwable- Returns:
- a LoggingEventBuilder, usually this.
-
log
Description copied from interface:LoggingEventBuilderAfter the logging event is built, performs actual logging. This method must be called for logging to occur. If the call toLoggingEventBuilder.log()is omitted, aLoggingEventwill be built but no logging will occur.- Specified by:
login interfaceLoggingEventBuilder
-
setMessage
Description copied from interface:LoggingEventBuilderSets the message of the logging event.- Specified by:
setMessagein interfaceLoggingEventBuilder
-
setMessage
Description copied from interface:LoggingEventBuilderSets the message of the event via a message supplier.- Specified by:
setMessagein interfaceLoggingEventBuilder- Parameters:
messageSupplier- supplies a String to be used as the message for the event
-
log
Description copied from interface:LoggingEventBuilderEquivalent to callingLoggingEventBuilder.setMessage(String)followed byLoggingEventBuilder.log();- Specified by:
login interfaceLoggingEventBuilder- Parameters:
message- the message to log
-
log
Description copied from interface:LoggingEventBuilderEquivalent to callingLoggingEventBuilder.setMessage(Supplier)followed byLoggingEventBuilder.log()- Specified by:
login interfaceLoggingEventBuilder- Parameters:
messageSupplier- a Supplier returning a message of type String
-
log
Description copied from interface:LoggingEventBuilderEquivalent to callingLoggingEventBuilder.setMessage(String)followed byLoggingEventBuilder.addArgument(Object)} and thenLoggingEventBuilder.log()- Specified by:
login interfaceLoggingEventBuilder- Parameters:
message- the message to logarg- an argument to be used with the message to log
-
log
Description copied from interface:LoggingEventBuilderEquivalent to callingLoggingEventBuilder.setMessage(String)followed by two calls toLoggingEventBuilder.addArgument(Object)and thenLoggingEventBuilder.log()- Specified by:
login 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:LoggingEventBuilderEquivalent 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:
login interfaceLoggingEventBuilder- Parameters:
message- the message to logargs- a list (actually an array) of arguments to be used with the message to log
-