Plug Logger JSON v0.1.0 Plug.LoggerJSON

A plug for logging basic request information in the format:

{
  "api_version":     "N/A"
  "client_ip":       "23.235.46.37"
  "client_version":  "ios/1.6.7",
  "date_time":       "2016-05-31T18:00:13Z",
  "duration":        4.670,
  "fastly_duration": 2.670,
  "handler":         "fronts#index"
  "log_type":        "http",
  "method":          "POST",
  "params":          {
                       "user":"jkelly",
                       "password":"[FILTERED]"
                     },
  "path":            "/",
  "request_id":      "d90jcl66vp09r8tke3utjsd1pjrg4ln8",
  "status":          "200"
}

To use it, just plug it into the desired module. plug Plug.LoggerJSON, log: :debug

Options

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

Summary

Functions

Callback implementation for c:Plug.call/2

Callback implementation for c:Plug.init/1

Functions

call(conn, level)

Specs

call(Plug.Conn.t, atom) :: Plug.Conn.t

Callback implementation for c:Plug.call/2.

init(opts)

Callback implementation for c:Plug.init/1.

log(conn, level, start)

Specs

log(Plug.Conn.t, atom, {non_neg_integer, non_neg_integer, non_neg_integer}) :: atom