Top Description Methods
org.slf4j.spi

public Interface LoggingEventBuilder

Known Direct Implementers
org.slf4j.spi.NOPLoggingEventBuilder, org.slf4j.spi.DefaultLoggingEventBuilder
Imports
java.util.function.Supplier, org.slf4j.Marker, org.slf4j.helpers.CheckReturnValue

This is the main interface in slf4j's fluent API for creating logging events.
Author
Ceki Gülcü
Since
2.0.0

Method Summary

Modifier and TypeMethod and Description
public LoggingEventBuilder

Returns:

a LoggingEventBuilder, usually this.
addArgument
(Object
an Object to add.
p
)

Add an argument to the event being built.

public LoggingEventBuilder

Returns:

a LoggingEventBuilder, usually this.
addArgument
(Supplier<?>
an Object supplier to add.
objectSupplier
)

Add an argument supplier to the event being built.

public LoggingEventBuilder

Returns:

a LoggingEventBuilder, usually this.
addKeyValue
(String
the key of the key value pair.
key
,
Object
the value of the key value pair.
value
)

Add a key value pair to the event being built.

public LoggingEventBuilder

Returns:

a LoggingEventBuilder, usually this.
addKeyValue
(String
the key of the key value pair.
key
,
Supplier<Object>
a supplier of a value for the key value pair.
valueSupplier
)

Add a key value pair to the event being built.

public LoggingEventBuilder

Returns:

a LoggingEventBuilder, usually this.
addMarker
(Marker
a Marker instance to add.
marker
)

A marker to the event being built.

public void
log()

After the logging event is built, performs actual logging.

public void
log(String
the message to log
message
)

Equivalent to calling setMessage(String) followed by log();

public void
log(String
the message to log
message
,
Object
an argument to be used with the message to log
arg
)

Equivalent to calling setMessage(String) followed by addArgument(Object)} and then log()

public void
log(String
the message to log
message
,
Object
first argument to be used with the message to log
arg0
,
Object
second argument to be used with the message to log
arg1
)

Equivalent to calling setMessage(String) followed by two calls to addArgument(Object) and then log()

public void
log(String
the message to log
message
,
Object...
a list (actually an array) of arguments to be used with the message to log
args
)

Equivalent to calling setMessage(String) followed by zero or more calls to addArgument(Object) (depending on the size of args array) and then log()

public void
log(Supplier<String>
a Supplier returning a message of type String
messageSupplier
)

Equivalent to calling setMessage(Supplier) followed by log()

public LoggingEventBuilder

Returns:

a LoggingEventBuilder, usually this.
setCause
(Throwable
a throwable
cause
)

Set the cause for the logging event being built.

public LoggingEventBuilder
setMessage(String message)

Sets the message of the logging event.

public LoggingEventBuilder
setMessage(Supplier<String>
supplies a String to be used as the message for the event
messageSupplier
)

Sets the message of the event via a message supplier.

Method Detail

addArgumentback to summary
public LoggingEventBuilder addArgument(Object p)

Add an argument to the event being built.

Parameters
p:Object

an Object to add.

Returns:LoggingEventBuilder

a LoggingEventBuilder, usually this.

Annotations
@CheckReturnValue
addArgumentback to summary
public LoggingEventBuilder addArgument(Supplier<?> objectSupplier)

Add an argument supplier to the event being built.

Parameters
objectSupplier:Supplier<?>

an Object supplier to add.

Returns:LoggingEventBuilder

a LoggingEventBuilder, usually this.

Annotations
@CheckReturnValue
addKeyValueback to summary
public LoggingEventBuilder addKeyValue(String key, Object value)

Add a key value pair to the event being built.

Parameters
key:String

the key of the key value pair.

value:Object

the value of the key value pair.

Returns:LoggingEventBuilder

a LoggingEventBuilder, usually this.

Annotations
@CheckReturnValue
addKeyValueback to summary
public LoggingEventBuilder addKeyValue(String key, Supplier<Object> valueSupplier)

Add a key value pair to the event being built.

Parameters
key:String

the key of the key value pair.

valueSupplier:Supplier<Object>

a supplier of a value for the key value pair.

Returns:LoggingEventBuilder

a LoggingEventBuilder, usually this.

Annotations
@CheckReturnValue
addMarkerback to summary
public LoggingEventBuilder addMarker(Marker marker)

A marker to the event being built.

Parameters
marker:Marker

a Marker instance to add.

Returns:LoggingEventBuilder

a LoggingEventBuilder, usually this.

Annotations
@CheckReturnValue
logback to summary
public void log()

After the logging event is built, performs actual logging. This method must be called for logging to occur. If the call to log() is omitted, a LoggingEvent will be built but no logging will occur.

Since
2.0.0-beta0
logback to summary
public void log(String message)

Equivalent to calling setMessage(String) followed by log();

Parameters
message:String

the message to log

logback to summary
public void log(String message, Object arg)

Equivalent to calling setMessage(String) followed by addArgument(Object)} and then log()

Parameters
message:String

the message to log

arg:Object

an argument to be used with the message to log

logback to summary
public void log(String message, Object arg0, Object arg1)

Equivalent to calling setMessage(String) followed by two calls to addArgument(Object) and then log()

Parameters
message:String

the message to log

arg0:Object

first argument to be used with the message to log

arg1:Object

second argument to be used with the message to log

logback to summary
public void log(String message, Object... args)

Equivalent to calling setMessage(String) followed by zero or more calls to addArgument(Object) (depending on the size of args array) and then log()

Parameters
message:String

the message to log

args:Object[]

a list (actually an array) of arguments to be used with the message to log

logback to summary
public void log(Supplier<String> messageSupplier)

Equivalent to calling setMessage(Supplier) followed by log()

Parameters
messageSupplier:Supplier<String>

a Supplier returning a message of type String

setCauseback to summary
public LoggingEventBuilder setCause(Throwable cause)

Set the cause for the logging event being built.

Parameters
cause:Throwable

a throwable

Returns:LoggingEventBuilder

a LoggingEventBuilder, usually this.

Annotations
@CheckReturnValue
setMessageback to summary
public LoggingEventBuilder setMessage(String message)

Sets the message of the logging event.

Annotations
@CheckReturnValue
Since
2.0.0-beta0
setMessageback to summary
public LoggingEventBuilder setMessage(Supplier<String> messageSupplier)

Sets the message of the event via a message supplier.

Parameters
messageSupplier:Supplier<String>

supplies a String to be used as the message for the event

Annotations
@CheckReturnValue
Since
2.0.0-beta0