Caddy.Logger.Handler (Caddy v2.3.1)
View SourceDefault telemetry handler that forwards log events to Elixir's Logger.
Automatically attached by Caddy.Logger unless disabled via configuration:
config :caddy, attach_default_handler: falseRespects configured log level:
config :caddy, log_level: :info # Only :info and aboveTelemetry Events Handled
This handler listens to:
[:caddy, :log, :debug][:caddy, :log, :info][:caddy, :log, :warning][:caddy, :log, :error][:caddy, :log, :received]- Caddy process output
Performance
This handler is designed to be lightweight with minimal memory allocation. It forwards events synchronously to Elixir's Logger, which handles buffering and I/O asynchronously.
Summary
Functions
@spec attach() :: :ok | {:error, term()}
Attaches the default handler to all Caddy log events.
Returns :ok if successful, or {:error, :already_exists} if the
handler is already attached.
@spec detach() :: :ok | {:error, :not_found}
Detaches the default handler.