Package org.slf4j.spi
Interface LoggingEventBuilder
- All Known Implementing Classes:
- DefaultLoggingEventBuilder,- NOPLoggingEventBuilder
public interface LoggingEventBuilder
This is the main interface in slf4j's fluent API for creating
 
logging events.- Since:
- 2.0.0
- Author:
- Ceki Gülcü
- 
Method SummaryModifier 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> valueSupplier) 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 callingsetMessage(String)followed bylog();voidvoidEquivalent to callingsetMessage(String)followed by zero or more calls toaddArgument(Object)(depending on the size of args array) and thenlog()voidEquivalent to callingsetMessage(String)followed by two calls toaddArgument(Object)and thenlog()voidEquivalent to callingsetMessage(Supplier)followed bylog()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.
- 
Method Details- 
setCauseSet the cause for the logging event being built.- Parameters:
- cause- a throwable
- Returns:
- a LoggingEventBuilder, usually this.
 
- 
addMarkerAmarkerto the event being built.- Parameters:
- marker- a Marker instance to add.
- Returns:
- a LoggingEventBuilder, usually this.
 
- 
addArgumentAdd an argument to the event being built.- Parameters:
- p- an Object to add.
- Returns:
- a LoggingEventBuilder, usually this.
 
- 
addArgumentAdd an argument supplier to the event being built.- Parameters:
- objectSupplier- an Object supplier to add.
- Returns:
- a LoggingEventBuilder, usually this.
 
- 
addKeyValueAdd akey value pairto the event being built.- Parameters:
- key- the key of the key value pair.
- value- the value of the key value pair.
- Returns:
- a LoggingEventBuilder, usually this.
 
- 
addKeyValueAdd akey value pairto the event being built.- Parameters:
- key- the key of the key value pair.
- valueSupplier- a supplier of a value for the key value pair.
- Returns:
- a LoggingEventBuilder, usually this.
 
- 
setMessageSets the message of the logging event.- Since:
- 2.0.0-beta0
 
- 
setMessageSets the message of the event via a message supplier.- Parameters:
- messageSupplier- supplies a String to be used as the message for the event
- Since:
- 2.0.0-beta0
 
- 
logvoid log()After the logging event is built, performs actual logging. This method must be called for logging to occur. If the call tolog()is omitted, aLoggingEventwill be built but no logging will occur.- Since:
- 2.0.0-beta0
 
- 
logEquivalent to callingsetMessage(String)followed bylog();- Parameters:
- message- the message to log
 
- 
log- Parameters:
- message- the message to log
- arg- an argument to be used with the message to log
 
- 
logEquivalent to callingsetMessage(String)followed by two calls toaddArgument(Object)and thenlog()- Parameters:
- message- the message to log
- arg0- first argument to be used with the message to log
- arg1- second argument to be used with the message to log
 
- 
logEquivalent to callingsetMessage(String)followed by zero or more calls toaddArgument(Object)(depending on the size of args array) and thenlog()- Parameters:
- message- the message to log
- args- a list (actually an array) of arguments to be used with the message to log
 
- 
logEquivalent to callingsetMessage(Supplier)followed bylog()- Parameters:
- messageSupplier- a Supplier returning a message of type String
 
 
-