public class TestLoggingEventBuilder
extends org.slf4j.spi.DefaultLoggingEventBuilder
LoggingEventBuilder
which changes the following compared to DefaultLoggingEventBuilder
:
toLoggingEvent()
method is added to build the event without logging it.
TestLoggingEventBuilder
. This allows
toLoggingEvent()
to be used in a fluent manner.
KeyValuePair
implementation overrides the Object.equals(java.lang.Object)
and Object.hashCode()
methods. This allows tests for equality in test assertions.
Modifier and Type | Class and Description |
---|---|
static class |
TestLoggingEventBuilder.TestKeyValuePair
Extension of
KeyValuePair with overridden Object.equals(java.lang.Object) and Object.hashCode() methods. |
Constructor and Description |
---|
TestLoggingEventBuilder(org.slf4j.Logger logger,
org.slf4j.event.Level level) |
Modifier and Type | Method and Description |
---|---|
TestLoggingEventBuilder |
addArgument(Object p) |
TestLoggingEventBuilder |
addArgument(Supplier<?> objectSupplier) |
TestLoggingEventBuilder |
addKeyValue(String key,
Object value) |
TestLoggingEventBuilder |
addKeyValue(String key,
Supplier<Object> valueSupplier) |
TestLoggingEventBuilder |
addMarker(org.slf4j.Marker marker) |
TestLoggingEventBuilder |
setCause(Throwable cause) |
TestLoggingEventBuilder |
setMessage(String message) |
TestLoggingEventBuilder |
setMessage(Supplier<String> messageSupplier) |
org.slf4j.event.LoggingEvent |
toLoggingEvent()
Build the event, without logging it.
|
public TestLoggingEventBuilder(org.slf4j.Logger logger, org.slf4j.event.Level level)
public org.slf4j.event.LoggingEvent toLoggingEvent()
@CheckReturnValue public TestLoggingEventBuilder setCause(Throwable cause)
setCause
in interface org.slf4j.spi.LoggingEventBuilder
setCause
in class org.slf4j.spi.DefaultLoggingEventBuilder
@CheckReturnValue public TestLoggingEventBuilder addMarker(org.slf4j.Marker marker)
addMarker
in interface org.slf4j.spi.LoggingEventBuilder
addMarker
in class org.slf4j.spi.DefaultLoggingEventBuilder
@CheckReturnValue public TestLoggingEventBuilder addArgument(Object p)
addArgument
in interface org.slf4j.spi.LoggingEventBuilder
addArgument
in class org.slf4j.spi.DefaultLoggingEventBuilder
@CheckReturnValue public TestLoggingEventBuilder addArgument(Supplier<?> objectSupplier)
addArgument
in interface org.slf4j.spi.LoggingEventBuilder
addArgument
in class org.slf4j.spi.DefaultLoggingEventBuilder
@CheckReturnValue public TestLoggingEventBuilder addKeyValue(String key, Object value)
addKeyValue
in interface org.slf4j.spi.LoggingEventBuilder
addKeyValue
in class org.slf4j.spi.DefaultLoggingEventBuilder
@CheckReturnValue public TestLoggingEventBuilder addKeyValue(String key, Supplier<Object> valueSupplier)
addKeyValue
in interface org.slf4j.spi.LoggingEventBuilder
addKeyValue
in class org.slf4j.spi.DefaultLoggingEventBuilder
@CheckReturnValue public TestLoggingEventBuilder setMessage(String message)
setMessage
in interface org.slf4j.spi.LoggingEventBuilder
setMessage
in class org.slf4j.spi.DefaultLoggingEventBuilder
@CheckReturnValue public TestLoggingEventBuilder setMessage(Supplier<String> messageSupplier)
setMessage
in interface org.slf4j.spi.LoggingEventBuilder
setMessage
in class org.slf4j.spi.DefaultLoggingEventBuilder
Copyright © 2023. All rights reserved.