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 Details

    • ns

      LogEntryCustomizer ns(String namespace)
      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

      default LogEntryCustomizer ns(Enum<?> namespace)
      Nest the log entry with a namespace
      Parameters:
      namespace - the namespace
      Returns:
      self
      See Also:
      ns(String)
    • with

      LogEntryCustomizer with(String key, Object value)
      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 via toString(). Null values are ignored.
      Returns:
      self
    • with

      default LogEntryCustomizer with(Enum<?> key, Object value)
      Attach a key-value pair to the log entry.
      Parameters:
      key - the entry key
      value - the entry value
      Returns:
      self
      See Also:
      with(String, Object)
    • withThrowable

      LogEntryCustomizer withThrowable(Throwable t)
      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