# `Zexbox.Logging`
[🔗](https://github.com/Intellection/zexbox/blob/main/lib/zexbox/logging.ex#L1)

Module for logging events in Zexbox.

# `attach_controller_logs!`

```elixir
@spec attach_controller_logs!() :: :ok
```

Attaches Telemetry handlers for Phoenix controller events.

This function sets up handlers for the `[:phoenix, :endpoint, :stop]` and `[:phoenix, :endpoint, :start]` events.
The handlers are named `"phoenix_controller_logs_stop"` and `"phoenix_controller_logs_start"`,
both of which use the `LogHandler.handle_event/4` function to process the events.

## Examples

    iex> Logging.attach_controller_logs()
    :ok
    iex> Logging.attach_controller_logs()
    ** (RuntimeError) event already exists

# `json_formatter_config`

```elixir
@spec json_formatter_config(keyword()) :: {module(), map()}
```

Returns a JSON `:logger` formatter with Zappi defaults, for use in `config/runtime.exs`.
Requires the optional `:logger_json` dependency:

    config :logger, :default_handler,
      formatter: Zexbox.Logging.json_formatter_config()

See `Zexbox.Logging.JsonFormatter.config/1` for options.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
