Caddy.Logger (Caddy v2.3.1)

View Source

Supervisor for Caddy logging subsystem.

Collects caddy process logs from stdout and stderr and maintains a rolling buffer of up to 50,000 lines of logs.

Telemetry Integration

Automatically attaches a default handler that forwards telemetry log events to Elixir's Logger. Disable with:

config :caddy, attach_default_handler: false

Configure log level filtering:

config :caddy, log_level: :info  # Only :info and above

Usage

# Get recent logs
logs = Caddy.Logger.tail(100)

# Listen to telemetry events
:telemetry.attach("my_handler", [:caddy, :log, :stored], fn _event, _meas, metadata, _config ->
  IO.puts("Log stored: " <> metadata.message)
end, %{})

Summary

Functions

Returns a specification to start this module under a supervisor.

Get latest num logs

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(args)

tail(num \\ 100)

@spec tail(integer()) :: [binary()]

Get latest num logs