public class DefaultLoggingEventBuilder extends Object implements LoggingEventBuilder, CallerBoundaryAware
LoggingEventBuilder| Modifier and Type | Field and Description |
|---|---|
protected Logger |
logger |
protected DefaultLoggingEvent |
loggingEvent |
| Constructor and Description |
|---|
DefaultLoggingEventBuilder(Logger logger,
Level level) |
| Modifier and Type | Method and Description |
|---|---|
LoggingEventBuilder |
addArgument(Object p)
Add an argument to the event being built.
|
LoggingEventBuilder |
addArgument(Supplier<?> objectSupplier)
Add an argument supplier to the event being built.
|
LoggingEventBuilder |
addKeyValue(String key,
Object value)
Add a
key value pair to the event being built. |
LoggingEventBuilder |
addKeyValue(String key,
Supplier<Object> value)
Add a
key value pair to the event being built. |
LoggingEventBuilder |
addMarker(Marker marker)
Add a marker to the current logging event being built.
|
void |
log()
After the logging event is built, performs actual logging.
|
protected void |
log(LoggingEvent aLoggingEvent) |
void |
log(String message)
Equivalent to calling
LoggingEventBuilder.setMessage(String) followed by LoggingEventBuilder.log(); |
void |
log(String message,
Object... args)
Equivalent to calling
LoggingEventBuilder.setMessage(String) followed by zero or more calls to
LoggingEventBuilder.addArgument(Object) (depending on the size of args array) and then LoggingEventBuilder.log() |
void |
log(String message,
Object arg)
Equivalent to calling
LoggingEventBuilder.setMessage(String) followed by LoggingEventBuilder.addArgument(Object)}
and then LoggingEventBuilder.log() |
void |
log(String message,
Object arg0,
Object arg1)
Equivalent to calling
LoggingEventBuilder.setMessage(String) followed by two calls to
LoggingEventBuilder.addArgument(Object) and then LoggingEventBuilder.log() |
void |
log(Supplier<String> messageSupplier)
Equivalent to calling
LoggingEventBuilder.setMessage(Supplier) followed by LoggingEventBuilder.log() |
void |
setCallerBoundary(String fqcn)
Add a fqcn (fully qualified class name) to this event, presumed to be the caller boundary.
|
LoggingEventBuilder |
setCause(Throwable t)
Set the cause for the logging event being built.
|
LoggingEventBuilder |
setMessage(String message)
Sets the message of the logging event.
|
LoggingEventBuilder |
setMessage(Supplier<String> messageSupplier)
Sets the message of the event via a message supplier.
|
protected DefaultLoggingEvent loggingEvent
public DefaultLoggingEventBuilder(Logger logger, Level level)
public LoggingEventBuilder addMarker(Marker marker)
addMarker in interface LoggingEventBuildermarker - the marker to addpublic LoggingEventBuilder setCause(Throwable t)
LoggingEventBuildersetCause in interface LoggingEventBuildert - a throwablepublic LoggingEventBuilder addArgument(Object p)
LoggingEventBuilderaddArgument in interface LoggingEventBuilderp - an Object to add.public LoggingEventBuilder addArgument(Supplier<?> objectSupplier)
LoggingEventBuilderaddArgument in interface LoggingEventBuilderobjectSupplier - an Object supplier to add.public void setCallerBoundary(String fqcn)
CallerBoundaryAwaresetCallerBoundary in interface CallerBoundaryAwarepublic void log()
LoggingEventBuilderLoggingEventBuilder.log() is omitted, a LoggingEvent
will be built but no logging will occur.log in interface LoggingEventBuilderpublic LoggingEventBuilder setMessage(String message)
LoggingEventBuildersetMessage in interface LoggingEventBuilderpublic LoggingEventBuilder setMessage(Supplier<String> messageSupplier)
LoggingEventBuildersetMessage in interface LoggingEventBuildermessageSupplier - supplies a String to be used as the message for the eventpublic void log(String message)
LoggingEventBuilderLoggingEventBuilder.setMessage(String) followed by LoggingEventBuilder.log();log in interface LoggingEventBuildermessage - the message to logpublic void log(String message, Object arg)
LoggingEventBuilderLoggingEventBuilder.setMessage(String) followed by LoggingEventBuilder.addArgument(Object)}
and then LoggingEventBuilder.log()log in interface LoggingEventBuildermessage - the message to logarg - an argument to be used with the message to logpublic void log(String message, Object arg0, Object arg1)
LoggingEventBuilderLoggingEventBuilder.setMessage(String) followed by two calls to
LoggingEventBuilder.addArgument(Object) and then LoggingEventBuilder.log()log in interface LoggingEventBuildermessage - the message to logarg0 - first argument to be used with the message to logarg1 - second argument to be used with the message to logpublic void log(String message, Object... args)
LoggingEventBuilderLoggingEventBuilder.setMessage(String) followed by zero or more calls to
LoggingEventBuilder.addArgument(Object) (depending on the size of args array) and then LoggingEventBuilder.log()log in interface LoggingEventBuildermessage - the message to logargs - a list (actually an array) of arguments to be used with the message to logpublic void log(Supplier<String> messageSupplier)
LoggingEventBuilderLoggingEventBuilder.setMessage(Supplier) followed by LoggingEventBuilder.log()log in interface LoggingEventBuildermessageSupplier - a Supplier returning a message of type Stringprotected void log(LoggingEvent aLoggingEvent)
public LoggingEventBuilder addKeyValue(String key, Object value)
LoggingEventBuilderkey value pair to the event being built.addKeyValue in interface LoggingEventBuilderkey - the key of the key value pair.value - the value of the key value pair.public LoggingEventBuilder addKeyValue(String key, Supplier<Object> value)
LoggingEventBuilderkey value pair to the event being built.addKeyValue in interface LoggingEventBuilderkey - the key of the key value pair.value - a supplier of a value for the key value pair.Copyright © 2005–2022 QOS.ch. All rights reserved.