Top Description Fields Constructors Methods
org.slf4j.spi

public Class DefaultLoggingEventBuilder

extends Object
implements LoggingEventBuilder, CallerBoundaryAware
Class Inheritance
All Implemented Interfaces
org.slf4j.spi.CallerBoundaryAware, org.slf4j.spi.LoggingEventBuilder
Imports
java.util.List, java.util.function.Supplier, org.slf4j.Logger, .Marker, org.slf4j.event.DefaultLoggingEvent, .KeyValuePair, .Level, .LoggingEvent

Default implementation of LoggingEventBuilder

Field Summary

Modifier and TypeField and Description
pack-priv static String
protected Logger
protected DefaultLoggingEvent

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public LoggingEventBuilder
addArgument(Object p)

Implements org.slf4j.spi.LoggingEventBuilder.addArgument.

Add an argument to the event being built.

public LoggingEventBuilder
addArgument(Supplier<?> objectSupplier)

Implements org.slf4j.spi.LoggingEventBuilder.addArgument.

Add an argument supplier to the event being built.

public LoggingEventBuilder
addKeyValue(String key, Object value)

Implements org.slf4j.spi.LoggingEventBuilder.addKeyValue.

Add a key value pair to the event being built.

public LoggingEventBuilder
addKeyValue(String key, Supplier<Object> value)

Implements org.slf4j.spi.LoggingEventBuilder.addKeyValue.

Add a key value pair to the event being built.

public LoggingEventBuilder
addMarker(Marker
the marker to add
marker
)

Implements org.slf4j.spi.LoggingEventBuilder.addMarker.

Add a marker to the current logging event being built.

public void
log()

Implements org.slf4j.spi.LoggingEventBuilder.log.

After the logging event is built, performs actual logging.

public void
log(String message)

Implements org.slf4j.spi.LoggingEventBuilder.log.

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

public void
log(String message, Object arg)

Implements org.slf4j.spi.LoggingEventBuilder.log.

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

public void
log(String message, Object arg0, Object arg1)

Implements org.slf4j.spi.LoggingEventBuilder.log.

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

public void
log(String message, Object... args)

Implements org.slf4j.spi.LoggingEventBuilder.log.

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> messageSupplier)

Implements org.slf4j.spi.LoggingEventBuilder.log.

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

protected void
log(LoggingEvent aLoggingEvent)

private void
private void
private StringBuilder
private StringBuilder
private String
mergeMarkersAndKeyValuePairsAndMessage(LoggingEvent aLoggingEvent)

Prepend markers and key-value pairs to the message.

private String
public void
setCallerBoundary(String fqcn)

Implements org.slf4j.spi.CallerBoundaryAware.setCallerBoundary.

Add a fqcn (fully qualified class name) to this event, presumed to be the caller boundary.

public LoggingEventBuilder
setCause(Throwable t)

Implements org.slf4j.spi.LoggingEventBuilder.setCause.

Set the cause for the logging event being built.

public LoggingEventBuilder
setMessage(String message)

Implements org.slf4j.spi.LoggingEventBuilder.setMessage.

Sets the message of the logging event.

public LoggingEventBuilder
setMessage(Supplier<String> messageSupplier)

Implements org.slf4j.spi.LoggingEventBuilder.setMessage.

Sets the message of the event via a message supplier.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DLEB_FQCNback to summary
pack-priv static String DLEB_FQCN
loggerback to summary
protected Logger logger
loggingEventback to summary
protected DefaultLoggingEvent loggingEvent

Constructor Detail

DefaultLoggingEventBuilderback to summary
public DefaultLoggingEventBuilder(Logger logger, Level level)

Method Detail

addArgumentback to summary
public LoggingEventBuilder addArgument(Object p)

Implements org.slf4j.spi.LoggingEventBuilder.addArgument.

Doc from org.slf4j.spi.LoggingEventBuilder.addArgument.

Add an argument to the event being built.

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

Implements org.slf4j.spi.LoggingEventBuilder.addArgument.

Doc from org.slf4j.spi.LoggingEventBuilder.addArgument.

Add an argument supplier to the event being built.

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

Implements org.slf4j.spi.LoggingEventBuilder.addKeyValue.

Doc from org.slf4j.spi.LoggingEventBuilder.addKeyValue.

Add a key value pair to the event being built.

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

Implements org.slf4j.spi.LoggingEventBuilder.addKeyValue.

Doc from org.slf4j.spi.LoggingEventBuilder.addKeyValue.

Add a key value pair to the event being built.

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

Implements org.slf4j.spi.LoggingEventBuilder.addMarker.

Add a marker to the current logging event being built.

It is possible to add multiple markers to the same logging event.

Parameters
marker:Marker

the marker to add

Annotations
@Override
logback to summary
public void log()

Implements org.slf4j.spi.LoggingEventBuilder.log.

Doc from org.slf4j.spi.LoggingEventBuilder.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.

Annotations
@Override
logback to summary
public void log(String message)

Implements org.slf4j.spi.LoggingEventBuilder.log.

Doc from org.slf4j.spi.LoggingEventBuilder.log.

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

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

Implements org.slf4j.spi.LoggingEventBuilder.log.

Doc from org.slf4j.spi.LoggingEventBuilder.log.

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

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

Implements org.slf4j.spi.LoggingEventBuilder.log.

Doc from org.slf4j.spi.LoggingEventBuilder.log.

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

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

Implements org.slf4j.spi.LoggingEventBuilder.log.

Doc from org.slf4j.spi.LoggingEventBuilder.log.

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

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

Implements org.slf4j.spi.LoggingEventBuilder.log.

Doc from org.slf4j.spi.LoggingEventBuilder.log.

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

Annotations
@Override
logback to summary
protected void log(LoggingEvent aLoggingEvent)
logViaLocationAwareLoggerAPIback to summary
private void logViaLocationAwareLoggerAPI(LocationAwareLogger locationAwareLogger, LoggingEvent aLoggingEvent)
logViaPublicSLF4JLoggerAPIback to summary
private void logViaPublicSLF4JLoggerAPI(LoggingEvent aLoggingEvent)
mergeKeyValuePairsback to summary
private StringBuilder mergeKeyValuePairs(List<KeyValuePair> keyValuePairList, StringBuilder sb)
mergeMarkersback to summary
private StringBuilder mergeMarkers(List<Marker> markerList, StringBuilder sb)
mergeMarkersAndKeyValuePairsAndMessageback to summary
private String mergeMarkersAndKeyValuePairsAndMessage(LoggingEvent aLoggingEvent)

Prepend markers and key-value pairs to the message.

mergeMessageback to summary
private String mergeMessage(String msg, StringBuilder sb)
setCallerBoundaryback to summary
public void setCallerBoundary(String fqcn)

Implements org.slf4j.spi.CallerBoundaryAware.setCallerBoundary.

Doc from org.slf4j.spi.CallerBoundaryAware.setCallerBoundary.

Add a fqcn (fully qualified class name) to this event, presumed to be the caller boundary.

Annotations
@Override
setCauseback to summary
public LoggingEventBuilder setCause(Throwable t)

Implements org.slf4j.spi.LoggingEventBuilder.setCause.

Doc from org.slf4j.spi.LoggingEventBuilder.setCause.

Set the cause for the logging event being built.

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

Implements org.slf4j.spi.LoggingEventBuilder.setMessage.

Doc from org.slf4j.spi.LoggingEventBuilder.setMessage.

Sets the message of the logging event.

Annotations
@Override
setMessageback to summary
public LoggingEventBuilder setMessage(Supplier<String> messageSupplier)

Implements org.slf4j.spi.LoggingEventBuilder.setMessage.

Doc from org.slf4j.spi.LoggingEventBuilder.setMessage.

Sets the message of the event via a message supplier.

Annotations
@Override