meta_logger v1.3.0 Tesla.Middleware.MetaLogger View Source

Tesla middleware to log requests and responses.

You can pass the options to the middleware or to the request Tesla.Env, env options takes precedence over middleware options.

Example usage

defmodule MyClient do

use Tesla

plug Tesla.Middleware.MetaLogger,

filter_headers: ["authorization"],
filter_query_params: [:api_key],
log_level: :debug,
log_tag: MyApp

end

Options

  • :filter_headers - The headers that should not be logged, the values will be replaced with [FILTERED], defaults to: [].
  • :filter_query_params - The query params that should not be logged, the values will be replaced with [FILTERED], defaults to: []
  • :log_level - The log level to be used, defaults to: :info. Responses with HTTP status 400 and above will be logged with :error, and redirect with :warn.
  • :log_tag - The log tag to be prefixed in the logs, default to: Tesla.Middleware.MetaLogger.