View Source Bandit.Logger (Bandit v1.5.7)

Logging conveniences for Bandit servers

Allows dynamically adding and altering the log level used to trace connections within a Bandit server via the use of telemetry hooks. Should you wish to do your own logging or tracking of these events, a complete list of the telemetry events emitted by Bandit is described in the module documentation for Bandit.Telemetry.

The logging included in this module is concerned specifically with protocol level events. Should you wish to log lower level transport concerns, there are similar functions to these in the ThousandIsland.Logger module. Corresponding telemetry events are described in the module documentation for ThousandIsland.Telemetry.

Summary

Types

Supported log levels

Functions

Start logging Bandit at the specified log level. Valid values for log level are :error and :info. Enabling a given log level implicitly enables all higher log levels as well.

Stop logging Thousand Island at the specified log level. Disabling a given log level implicitly disables all lower log levels as well.

Types

@type log_level() :: :error | :info

Supported log levels

Functions

@spec attach_logger(log_level()) :: :ok | {:error, :already_exists}

Start logging Bandit at the specified log level. Valid values for log level are :error and :info. Enabling a given log level implicitly enables all higher log levels as well.

@spec detach_logger(log_level()) :: :ok | {:error, :not_found}

Stop logging Thousand Island at the specified log level. Disabling a given log level implicitly disables all lower log levels as well.