Module creek.observability.logging
Interface LogEntryCustomizer
- All Known Implementing Classes:
DefaultLogEntryCustomizer
public interface LogEntryCustomizer
Log entry customization.
The methods on this type can be used to customize a log entry.
-
Method Summary
Modifier and TypeMethodDescriptiondefault LogEntryCustomizerNest the log entry with a namespaceNest the log entry within a namespace.default LogEntryCustomizerAttach a key-value pair to the log entry.Attach a key-value pair to the log entry.Attach an exception or error to the log entry.
-
Method Details
-
ns
Nest 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.
- Parameters:
namespace- the name of the namespace.- Returns:
- self.
-
ns
Nest the log entry with a namespace- Parameters:
namespace- the namespace- Returns:
- self
- See Also:
ns(String)
-
with
Attach 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.
- Parameters:
key- the name of the metric / value.value- the value to log, converted to a string viatoString(). Null values are ignored.- Returns:
- self
-
with
Attach a key-value pair to the log entry.- Parameters:
key- the entry keyvalue- the entry value- Returns:
- self
- See Also:
with(String, Object)
-
withThrowable
Attach 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.
- Parameters:
t- the throwable to attach.- Returns:
- self
-