# `Insider.Collector.Logger`
[🔗](https://github.com/hiivemarkets/insider/blob/v0.1.0/lib/insider/collector/logger.ex#L1)

Supervised, bounded ingestion of structured OTP Logger events.

OTP invokes handlers synchronously in the logging process. The handler only
performs bounded shaping and a single fixed-slot ETS insertion. This process
drains that inbox into the recorder, keeping recorder recovery and pressure
work out of application logging paths.

Set `include_payload: false` to retain only normalized semantic attributes and
record `payload: nil`; this prevents Logger message content from entering the
recorder when a capture needs a stricter privacy boundary.

Set `rich: true` (with the payload included) to record the formatted message
text, the level, and the rendered Logger metadata instead of the bounded
message shape, with credentials masked. The live session's rich disclosure
profile uses it.

A gate with a Logger summary (`Insider.Collector.Gate`) counts the
messages it summarises by level, message template and call site, a
burst; every interval this process records one `logger_summary` event per
burst, after recording the burst's first message of the interval as its
exemplar, and names the exemplar's receipt. The gate admits at most
`Insider.Collector.Gate.max_bursts/0` bursts per interval; the messages
of the others are one overflow event per level, which counts the bursts
folded into it.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `flush`

```elixir
@spec flush(GenServer.server()) :: {:ok, map()} | {:error, :unavailable}
```

Drains the currently visible bounded inbox before returning collector status.

This is a barrier for entries visible when the collector handles the call.
Callers must quiesce producers before using it as an incident freeze boundary;
concurrently executing Logger filters may insert after the bounded scan.

# `start_link`

```elixir
@spec start_link({Insider.Recorder.Handle.t(), keyword()}) :: GenServer.on_start()
```

# `start_link`

```elixir
@spec start_link(Insider.Recorder.Handle.t(), keyword()) :: GenServer.on_start()
```

# `status`

```elixir
@spec status(GenServer.server()) :: {:ok, map()} | {:error, :unavailable}
```

# `stop`

```elixir
@spec stop(GenServer.server()) :: {:ok, map()} | {:error, :unavailable}
```

Removes the Logger filter, then drains the inbox, records every pending
burst interval, and stops, so every event admitted before the removal is
recorded or summarised. A filter call already running in another process
when the filter is removed may still insert after the drain.

---

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