- All Known Implementing Classes:
DefaultLoggingEventBuilder,NOPLoggingEventBuilder
logging events.- Since:
- 2.0.0
- Author:
- Ceki Gülcü
-
Method Summary
Modifier 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.default LoggingEventBuilderarg(boolean b) Add a value of typebooleanto the event being built.default LoggingEventBuilderarg(byte b) Add a value of typebyteto the event being built.default LoggingEventBuilderarg(char c) Add a value of typecharto the event being built.default LoggingEventBuilderarg(double d) Add a value of typedoubleto the event being built.default LoggingEventBuilderarg(float f) Add a value of typefloatto the event being built.default LoggingEventBuilderarg(int i) Add a value of typeintto the event being built.default LoggingEventBuilderarg(long l) Add a value of typelongto the event being built.default LoggingEventBuilderarg(short s) Add a value of typeshortto the event being built.default LoggingEventBuilderAdd an argument to the event being built.default LoggingEventBuilderAdd an argument supplier to the event being built.default LoggingEventBuilderAdd akey value pairto the event being built, with the value part being of typeboolean.default LoggingEventBuilderAdd akey value pairto the event being built, with the value part being of typebyte.default LoggingEventBuilderAdd akey value pairto the event being built, with the value part being of typechar.default LoggingEventBuilderAdd akey value pairto the event being built, with the value part being of typedouble.default LoggingEventBuilderAdd akey value pairto the event being built, with the value part being of typefloat.default LoggingEventBuilderAdd akey value pairto the event being built, with the value part being of typeint.default LoggingEventBuilderAdd akey value pairto the event being built, with the value part being of typelong.default LoggingEventBuilderAdd akey value pairto the event being built, with the value part being of typeshort.default LoggingEventBuilderAdd akey value pairto the event being built.default LoggingEventBuilderAdd akey value pairto 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
-
setCause
Set the cause for the logging event being built.- Parameters:
cause- a throwable- Returns:
- a LoggingEventBuilder instance, usually this.
-
addMarker
Amarkerto the event being built.- Parameters:
marker- a Marker instance to add.- Returns:
- a LoggingEventBuilder instance, usually this.
-
addArgument
Add an argument to the event being built. Synonymous witharg(Object)method.- Parameters:
p- an Object to add.- Returns:
- a LoggingEventBuilder instance, usually this.
-
arg
Add an argument to the event being built. Synonymous withaddArgument(Object)method.- Parameters:
p- an Object to add.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
addArgument
Add an argument supplier to the event being built. Synonymous with
arg(Supplier)method.- Parameters:
objectSupplier- an Object supplier to add.- Returns:
- a LoggingEventBuilder instance, usually this.
-
arg
Add an argument supplier to the event being built. Synonymous with
addArgument(Supplier)method.- Parameters:
objectSupplier- an Object supplier to add.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
arg
Add a value of typebooleanto the event being built.The default implementation simply casts to
Boolean. However, the NOP implementation, i.e.NOPLoggingEventBuilder, skips the cast.- Parameters:
b- a value of typebooleanvalue to add.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
arg
Add a value of typecharto the event being built.The default implementation simply casts to
Character. However, the NOP implementation, i.e.NOPLoggingEventBuilder, skips the cast.- Parameters:
c- a value of typecharvalue to add.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
arg
Add a value of typebyteto the event being built.The default implementation simply casts to
Byte. However, the NOP implementation, i.e.NOPLoggingEventBuilder, skips the cast.- Parameters:
b- a value of typebytevalue to add.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
arg
Add a value of typeshortto the event being built.The default implementation simply casts to
Short. However, the NOP implementation, i.e.NOPLoggingEventBuilder, skips the cast.- Parameters:
s- a value of typeshortvalue to add.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
arg
Add a value of typeintto the event being built.The default implementation simply casts to
Integer. However, the NOP implementation, i.e.NOPLoggingEventBuilder, skips the cast.- Parameters:
i- a value of typeintvalue to add.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
arg
Add a value of typelongto the event being built.The default implementation simply casts to
Long. However, the NOP implementation, i.e.NOPLoggingEventBuilder, skips the cast.- Parameters:
l- a value of typelongvalue to add.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
arg
Add a value of typefloatto the event being built.The default implementation simply casts to
Float. However, the NOP implementation, i.e.NOPLoggingEventBuilder, skips the cast.- Parameters:
f- a value of typefloatvalue to add.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
arg
Add a value of typedoubleto the event being built.The default implementation simply casts to
Double. However, the NOP implementation skips the cast.- Parameters:
d- a value of typedoublevalue to add.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
addKeyValue
Add 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 instance, usually this.
-
kv
Add akey value pairto the event being built. Synonymous withaddKeyValue(String, Object)method.- Parameters:
key- the key of the key value pair.value- the value of the key value pair.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
addKeyValue
Add 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 instance, usually this.
-
kv
Add akey value pairto the event being built. Synonymous withaddKeyValue(String, Supplier)method.- Parameters:
key- the key of the key value pair.valueSupplier- a supplier of a value for the key value pair.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
kv
Add a
key value pairto the event being built, with the value part being of typeboolean.The default implementation simply casts to value part to
Booleanbefore callingaddKeyValue(String, Object). However, the NOP implementation, i.eNOPLoggingEventBuilder, skips the cast.- Parameters:
key- the key of the key value pair.b- the value of typebooleanof the key value pair.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
kv
Add a
key value pairto the event being built, with the value part being of typechar.The default implementation simply casts to value part to
Characterbefore callingaddKeyValue(String, Object). However, the NOP implementation, i.eNOPLoggingEventBuilder, skips the cast.- Parameters:
key- the key of the key value pair.c- the value of typecharof the key value pair.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
kv
Add a
key value pairto the event being built, with the value part being of typebyte.The default implementation simply casts to value part to
Bytebefore callingaddKeyValue(String, Object). However, the NOP implementation, i.eNOPLoggingEventBuilder, skips the cast.- Parameters:
key- the key of the key value pair.b- the value of typebyteof the key value pair.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
kv
Add a
key value pairto the event being built, with the value part being of typeshort.The default implementation simply casts to value part to
Shortbefore callingaddKeyValue(String, Object). However, the NOP implementation, i.eNOPLoggingEventBuilder, skips the cast.- Parameters:
key- the key of the key value pair.s- the value of typeshortof the key value pair.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
kv
Add a
key value pairto the event being built, with the value part being of typeint.The default implementation simply casts to value part to
Integerbefore callingaddKeyValue(String, Object). However, the NOP implementation, i.eNOPLoggingEventBuilder, skips the cast.- Parameters:
key- the key of the key value pair.i- the value of typeintof the key value pair.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
kv
Add a
key value pairto the event being built, with the value part being of typelong.The default implementation simply casts to value part to
Integerbefore callingaddKeyValue(String, Object). However, the NOP implementation, i.eNOPLoggingEventBuilder, skips the cast.- Parameters:
key- the key of the key value pair.l- the value of typelongof the key value pair.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
kv
Add a
key value pairto the event being built, with the value part being of typefloat.The default implementation simply casts to value part to
Floatbefore callingaddKeyValue(String, Object). However, the NOP implementation, i.eNOPLoggingEventBuilder, skips the cast.- Parameters:
key- the key of the key value pair.f- the value of typefloatof the key value pair.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
kv
Add a
key value pairto the event being built, with the value part being of typedouble.The default implementation simply casts to value part to
Doublebefore callingaddKeyValue(String, Object). However, the NOP implementation, i.eNOPLoggingEventBuilder, skips the cast.- Parameters:
key- the key of the key value pair.f- the value of typedoubleof the key value pair.- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.1.0
-
setMessage
Sets the message of the logging event.- Parameters:
message- the message of the event- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.0.0
-
setMessage
Sets the message of the event via a message supplier.- Parameters:
messageSupplier- supplies a String to be used as the message for the event- Returns:
- a LoggingEventBuilder instance, usually this.
- Since:
- 2.0.0-beta0
-
log
void 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
-
log
Equivalent to callingsetMessage(String)followed bylog();- Parameters:
message- the message to log
-
log
- Parameters:
message- the message to logarg- an argument to be used with the message to log
-
log
Equivalent to callingsetMessage(String)followed by two calls toaddArgument(Object)and thenlog()- Parameters:
message- the message to logarg0- first argument to be used with the message to logarg1- second argument to be used with the message to log
-
log
Equivalent 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 logargs- a list (actually an array) of arguments to be used with the message to log
-
log
Equivalent to callingsetMessage(Supplier)followed bylog()- Parameters:
messageSupplier- a Supplier returning a message of type String
-