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

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.

Summary

Functions

Callback implementation for Plug.call/2.

Callback implementation for Plug.init/1.

Functions

@spec call(Plug.Conn.t(), Logger.level()) :: Plug.Conn.t()

Callback implementation for Plug.call/2.

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

Callback implementation for Plug.init/1.