Class LogFormatter

java.lang.Object
io.helidon.http.LogFormatter

public final class LogFormatter extends Object
Header formatter for protocol logs.
  • Method Details

    • create

      public static LogFormatter create(HttpLogConfig config)
      Create a formatter.
      Parameters:
      config - HTTP log configuration
      Returns:
      a new formatter
    • escape

      public static String escape(String value)
      Escape a string before including it in a log record.
      Parameters:
      value - value to escape
      Returns:
      escaped value
    • pathOnly

      public static String pathOnly(String requestTarget)
      Remove query and fragment data from a request target before logging it.
      Parameters:
      requestTarget - request target, possibly containing query or fragment
      Returns:
      path without query and fragment
    • format

      public String format(Headers headers)
      Format headers for protocol logs.

      Header names are always included. Header values are included only for configured safe header names.

      Parameters:
      headers - headers to format
      Returns:
      formatted headers
    • formatAll

      public String formatAll(Headers headers)
      Format all header values for explicitly enabled unsafe protocol logs.

      Header names and values are escaped, but values are not redacted.

      Parameters:
      headers - headers to format
      Returns:
      formatted headers