ExJsonLogger.Plug.Logger (ex_json_logger v1.3.0) View Source

A plug for logging request information through metadata.

Logger Metadata available:

  • method - request method
  • path - request path
  • status - request status (integer)
  • duration - time in milliseconds from connection to response (float)
  • format - (phoenix specific)
  • controller - (phoenix specific)
  • action - (phoenix specific)
  • query_string - raw unparsed request query string

Metadata is filtered by default so keys will need to be whitelisted.

Usage

To use with a Phoenix application, replace plug Plug.Logger in the projects endpoint.ex file with ExJsonLogger.Plug.Logger:

# plug Plug.Logger
plug ExJsonLogger.Plug.Logger

Options

  • :log - The log level at which this plug should log its request info. Default is :info.

Link to this section Summary

Functions

Callback implementation for Plug.call/2.

Callback implementation for Plug.init/1.

Link to this section Functions

Specs

Callback implementation for Plug.call/2.

Specs

init(Keyword.t()) :: Logger.level()

Callback implementation for Plug.init/1.