Ready-to-use telemetry logger for Bazaar events.
Logs all Bazaar operations with timing information to help identify performance bottlenecks.
Usage
Add to your application's start/2 function:
def start(_type, _args) do
Bazaar.Telemetry.Logger.attach()
children = [
# ...
]
Supervisor.start_link(children, strategy: :one_for_one)
endExample Output
[info] [Bazaar] checkout.create completed in 42ms (chk_123, incomplete)
[info] [Bazaar] checkout.update completed in 15ms (chk_123, ready_for_complete)
[info] [Bazaar] order.get completed in 8ms (ord_456, completed)
[info] [Bazaar] webhook.handle completed in 23ms (order.shipped)
[info] [Bazaar] discovery.profile completed in 2msOptions
You can customize the logger by passing options to attach/1:
Bazaar.Telemetry.Logger.attach(
level: :debug, # Log level (default: :info)
handler_id: "my-logger" # Custom handler ID (default: "bazaar-telemetry-logger")
)Detaching
To stop logging, call:
Bazaar.Telemetry.Logger.detach()