Plug.Logger

A plug for logging basic request information.

To use it, just plug it into the desired module. Currently it does not expect any option during initialization.

Request ID

This plug generates a :request_id metadata that can be used to identify requests in production. In order to log the request_id, you need to configure your logger backends to include it as part of the metadata:

config :logger, :console, metadata: [:request_id]

It is recommended to include this metadata in your production configuration file.

The request id can be received as part of the request in the header field x-request-id and it will be included in the response with the same name.

If you plan on sending your own request ids they must follow the following format:

1. Be greater than 20 characters 2. Be less than 200 characters 3. Consist of ASCII letters, digits, or the characters +, /, =, and -

If we receive an invalid request id we will generate a new one.

Summary

call(conn, config)

Callback implementation of Plug.call/2

init(opts)

Callback implementation of Plug.init/1

Functions

call(conn, config)

Callback implementation of Plug.call/2.

init(opts)

Callback implementation of Plug.init/1.