Plug.AccessLog.Formatter

Log message formatter.

Source

Summary

format(format, conn)

Formats a log message

Functions

format(format, conn)

Specs:

Formats a log message.

The :default format is :clf.

The following formatting directives are available:

  • %b - Size of response in bytes
  • %h - Remote hostname
  • %l - Remote logname
  • %r - First line of HTTP request
  • %>s - Response status code
  • %t - Time the request was received in the format [10/Jan/2015:14:46:18 +0100].
  • %u - Remote user

Note for %b: To determine the size of the response the “Content-Length” (exact case match required for now!) will be inspected and, if available, returned unverified. If the header is not present the response body will be inspected using byte_size/1.

Note for %h: The hostname will always be the ip of the client.

Note for %l: Always a dash (“-“).

Note for %r: For now the http version is always logged as “HTTP/1.1”, regardless of the true http version.

Note for %u: Currently not supported, defaults to a dash (“-“).

Source