Skip to content

docs(adr): add A-12 — structured debug logging via log/slog#3424

Open
dimension-zero wants to merge 1 commit intogopasspw:masterfrom
dimension-zero:docs/adr-structured-logging
Open

docs(adr): add A-12 — structured debug logging via log/slog#3424
dimension-zero wants to merge 1 commit intogopasspw:masterfrom
dimension-zero:docs/adr-structured-logging

Conversation

@dimension-zero
Copy link
Copy Markdown
Contributor

Summary

pkg/debug/ uses printf-style debug output that is unstructured and hard to parse in CI or log aggregators. log/slog is available in the stdlib (since Go 1.21; the project already requires Go 1.25), so there is zero dependency cost to migrating.

This PR adds docs/adr/A-12-structured-logging.md which:

  • Documents the current state and the observability limitation
  • Presents three options: full slog migration, no change, or JSON-flag-only
  • Recommends Option A (migrate pkg/debug internally to slog, keeping the public Log/V/LogN API unchanged) with a --log-format json flag in the same PR
  • Notes that structured key-value improvements at individual call sites across internal/ can follow incrementally

No code change. This ADR is a proposed decision record pending maintainer input.

Related issue: #3416

Test plan

  • Markdown renders correctly
  • ADR number A-12 does not conflict with existing docs/adr/ files

@dominikschulz
Copy link
Copy Markdown
Member

I am open to improvements of the log output, but currently it's primary focus are humans (or maybe Agents) debugging gopass. So structured logging is not a priority. I would like to keep the default format. But adding a separate - optional - output format would be fine with me.

Records the options for replacing pkg/debug's printf-style output with
log/slog: full migration (recommended), no change, or JSON-flag-only.
Recommends Option A — internal migration of pkg/debug keeping the public
API stable, with a --log-format json flag. No code change.

Signed-off-by: dimension-zero <zero@ditech.ai>
@dimension-zero dimension-zero force-pushed the docs/adr-structured-logging branch from 65ae3ba to bc6e46e Compare May 5, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants