Module creek.observability.logging
Class DefaultLogEntryCustomizer
java.lang.Object
org.creekservice.internal.observability.logging.structured.DefaultLogEntryCustomizer
- All Implemented Interfaces:
LogEntryCustomizer
Default impl of the
LogEntryCustomizer type.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the log entrystatic DefaultLogEntryCustomizerFactory methodNest the log entry within a namespace.Attach a key-value pair to the log entry.Attach an exception or error to the log entry.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.creekservice.api.observability.logging.structured.LogEntryCustomizer
ns, with
-
Method Details
-
create
Factory method- Parameters:
messageText- the text message to log- Returns:
- the log customizer.
-
ns
Description copied from interface:LogEntryCustomizerNest the log entry within a namespace.Namespacing log entries can make it easier to filter logs.
The method can be called multiple times to nest within multiple namespace.
- Specified by:
nsin interfaceLogEntryCustomizer- Parameters:
namespace- the name of the namespace.- Returns:
- self.
-
with
Description copied from interface:LogEntryCustomizerAttach a key-value pair to the log entry.Use this method to attach metrics or values to the log entry. Such metrics will be output in a standard format, making them much more machine-readable.
- Specified by:
within interfaceLogEntryCustomizer- Parameters:
key- the name of the metric / value.value- the value to log, converted to a string viatoString(). Null values are ignored.- Returns:
- self
-
withThrowable
Description copied from interface:LogEntryCustomizerAttach an exception or error to the log entry.The throwable will be passed down to the underlying logging system. This normally results in the stack trace being included in the log entry.
- Specified by:
withThrowablein interfaceLogEntryCustomizer- Parameters:
t- the throwable to attach.- Returns:
- self
-
build
Build the log entry- Returns:
- the structured log entry
-
throwable
- Returns:
- any throwable set.
-