View Source CanonicalLogs (Canonical Logs v0.1.0)
Top-level API for CanonicalLogs.
Link to this section Summary
Functions
Attaches CanonicalLogs handlers to Plug.Telemetry
events to gather and log metadata at the end of each request.
Filters metadata recursively by replacing values of keys that contain any of the given strings.
Link to this section Functions
@spec attach( event_prefix: [atom(), ...], conn_metadata: [atom()], absinthe_metadata: [atom()], filter_metadata_recursively: [String.t()] ) :: :ok
Attaches CanonicalLogs handlers to Plug.Telemetry
events to gather and log metadata at the end of each request.
options
Options
:event_prefix
- The event prefix forPlug.Telemetry
events. Defaults to[:phoenix, :endpoint]
.:filter_metadata_recursively
- A list of strings to filter out of the metadata. Defaults to[]
. Any atoms passed to this option will be converted to strings.
examples
Examples
iex> CanonicalLogs.attach()
:ok
Filters metadata recursively by replacing values of keys that contain any of the given strings.
examples
Examples
iex> CanonicalLogs.filter_metadata(%{foo: "bar", baz: %{qux: "quux"}}, ["qux"])
%{baz: %{qux: "[FILTERED]"}, foo: "bar"}