# `Cairnloop.Web.AuditLogPresenter`
[🔗](https://github.com/szTheory/cairnloop/blob/main/lib/cairnloop/web/audit_log_presenter.ex#L1)

Pure, total presenter for operator audit-log events (AUDIT-01).

Mirrors `ToolProposalPresenter`/`ReviewTaskPresenter`:
- Total functions with safe fallbacks — never crashes on unexpected input.
- Returns strings and atoms only — never markup, never raw Elixir terms.

Operates on the plain-map event shape the `Cairnloop.Auditor` behaviour returns
(`%{inserted_at:, actor_id:, action:, reason:, metadata:}`), so it works uniformly
for the governance-backed default auditor and any host-supplied auditor.

Brand: action atoms are humanized (never `inspect/1` to operators); the raw map is
only ever shown behind an explicit expander in the LiveView, never inline.

# `action_label`

Human label for an audit action/event_type (atom or string).

# `actor_label`

Human label for the actor; system/automated actions read as "System".

# `has_metadata?`

True when there is metadata worth showing in the raw expander.

# `matches?`

True when `event` matches the free-text `query` (case-insensitive). A blank query
matches everything. Searches the action label, actor, reason, and metadata values.

# `metadata_rows`

Humanized `{label, value}` rows for an event's metadata map.

Scalar values are stringified; nested/structured values are summarized as
"(structured value)" — the full raw map is only shown behind the explicit
expander in the LiveView, never inline (brand §5.6).

# `reason_label`

Optional reason text; nil/blank renders as an em dash.

# `timestamp_label`

Calm UTC timestamp label; nil/unknown renders as an em dash.

---

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