Interface StructuredLogFormatter<E>

Type Parameters:
E - the log event type
All Known Implementing Classes:
JsonWriterStructuredLogFormatter
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface StructuredLogFormatter<E>
Formats a log event to a structured log message.

Implementing classes can declare the following parameter types in the constructor:

When using Logback, implementing classes can also use the following parameter types in the constructor:
  • ThrowableProxyConverter

Since:
3.4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    format(E event)
    Formats the given log event to a String.
    default byte[]
    formatAsBytes(E event, Charset charset)
    Formats the given log event to a byte array.
  • Method Details

    • format

      String format(E event)
      Formats the given log event to a String.
      Parameters:
      event - the log event to write
      Returns:
      the formatted log event String
    • formatAsBytes

      default byte[] formatAsBytes(E event, Charset charset)
      Formats the given log event to a byte array.
      Parameters:
      event - the log event to write
      charset - the charset
      Returns:
      the formatted log event bytes