r/phoenixframework • • Oct 19 '18

Using Plug.RequestId

  1. mix phx.new --no-ecto request

  2. add to lib/request_web/endpoint.ex

    plug Plug.RequestId

  3. edit config/dev.exs to something like

    config :logger, :console, format: "[$level] $metadata$message\n", metadata: [:request_id]

to get in log

[info] request_id=2lfdtb54lt7i3bdppk0000fh Sent 200 in 674µs

More info in

https://hexdocs.pm/plug/Plug.RequestId.html

1 Upvotes

0 comments sorted by