prop/config
Graham McIntire 52a32032a3
feat(logging): structured JSON logs in prod via LOG_FORMAT env var
The ingress + Grafana pipeline parses JSON-formatted log lines; Elixir's
default text formatter was the odd format everywhere else, forcing Loki
to fall back to free-text parsing. Swap the `:default` :logger handler's
formatter to `LoggerJSON.Formatters.Basic` when `LOG_FORMAT=json`.

Defaults: `LOG_FORMAT=text` for dev/test (no behaviour change), `json`
for prod. Whitelisted metadata covers the fields we actually correlate
on — `request_id`, `trace_id`, `worker`, `queue`, `job_id`.

OTP 28 / Elixir 1.19 exposes `Logger.Formatter.new/1` but ships no
JSON encoder of its own, so `logger_json` (~> 7.0) carries the rendering.
The test pokes the formatter directly rather than round-tripping through
ExUnit's capture_log, which replaces the handler and so can't see the
installed formatter's output.
2026-04-21 14:17:54 -05:00
..
config.exs feat(workers): add GridCachePruneWorker 2026-04-21 13:19:52 -05:00
dev.exs feat(workers): add GridCachePruneWorker 2026-04-21 13:19:52 -05:00
prod.exs Configure outbound SMTP email via Swoosh with TLS 2026-04-02 13:08:50 -05:00
runtime.exs feat(logging): structured JSON logs in prod via LOG_FORMAT env var 2026-04-21 14:17:54 -05:00
test.exs fix: stabilize flaky tests + silence PromEx Oban poller in test 2026-04-21 13:49:07 -05:00