Stock :telemetry handler that pretty-prints payment events to
Logger. Useful as a starter template -- copy + tailor for Datadog,
OpenTelemetry, Phoenix.LiveDashboard, etc.
Handles the three events emitted by Raxol.Payments.Telemetry:
[:raxol, :payments, :spend]->:info[:raxol, :payments, :over_budget]->:warning[:raxol, :payments, :freeze]->:warning(frozen) or:info(unfrozen)
Usage
# In your application start/2:
Raxol.Payments.Telemetry.LoggerHandler.attach()Detach with Raxol.Payments.Telemetry.LoggerHandler.detach/0.
Customization
The default formatter renders one structured line per event. To override:
Raxol.Payments.Telemetry.LoggerHandler.attach(handler_id: "my-pay",
formatter: &MyApp.format_pay_event/3)formatter/3 receives (event_name, measurements, metadata) and
returns the string passed to Logger.
Summary
Functions
Attach the handler to every event emitted by Raxol.Payments.Telemetry.
Default formatter: one-line structured rendering with the event name followed by sorted key/value pairs.
Detach the default handler. Pass handler_id to detach a custom one.
Types
Functions
@spec attach(keyword()) :: :ok | {:error, :already_exists}
Attach the handler to every event emitted by Raxol.Payments.Telemetry.
Returns :ok on success or {:error, :already_exists} if a handler
with the same id is already attached.
Default formatter: one-line structured rendering with the event name followed by sorted key/value pairs.
@spec detach(String.t()) :: :ok | {:error, :not_found}
Detach the default handler. Pass handler_id to detach a custom one.