Skip to content

feat(logging): unified log levels, Redact via LogValuer, CLI flag, settings migration#19

Merged
0xMMA merged 11 commits intomainfrom
feat/unified-logging
Apr 5, 2026
Merged

feat(logging): unified log levels, Redact via LogValuer, CLI flag, settings migration#19
0xMMA merged 11 commits intomainfrom
feat/unified-logging

Conversation

@0xMMA
Copy link
Copy Markdown
Owner

@0xMMA 0xMMA commented Apr 5, 2026

Summary

  • Log levels: Replace boolean debug_logging toggle with six-level system: off, trace, debug, info, warning, error
  • Sensitive redaction: Redact() wraps values with slog.LogValuer — shows [redacted] when sensitive logging is off, real value when on. Removes standalone Sensitive() function
  • Source tagging: All log entries carry source=backend or source=frontend for easy filtering
  • CLI: --log <level> flag on both -fix and -pyramidize commands (sensitive always off in CLI)
  • Settings migration: Legacy debug_logging: true auto-migrates to log_level: "debug" on load
  • Settings UI: PrimeNG Select dropdown replaces toggle, sensitive toggle disabled when level is "off"
  • Thread safety: sensitiveEnabled uses atomic.Bool for goroutine-safe reads during log calls
  • Documentation: docs/logging.md with conventions (Redact usage, source tagging, CLI flags)

Closes #2

Test plan

  • 14 logger tests (level filtering, redaction positive/negative, source tagging)
  • 6 settings migration tests (legacy to new, round-trip, both fields, defaults)
  • 4 CLI flag tests (valid/invalid levels, default, pyramidize)
  • 5 frontend bridge tests (source tag, redaction on/off, unknown level)
  • 25 settings UI tests (dropdown, sensitive toggle state, save)
  • Full Go test suite passes
  • Full frontend test suite passes (129/129)
  • Build compiles cleanly
  • No Sensitive() references remain in codebase

build-linux.yml CI will run automatically.

Generated with Claude Code

0xMMA and others added 11 commits April 5, 2026 19:23
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tegy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…agging

Replace bool-based Init(enabled, sensitive) with Init(level, sensitive) accepting
"trace", "debug", "info", "warning", "error", or "off". Add custom TRACE level,
Redact() wrapping values as slog.LogValuer for safe redaction, FrontendLogger()
with source=frontend tagging, and 14 tests covering level filtering, redaction,
and source tagging. Backward-compatible Sensitive() retained for Task 5 migration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…r, update spec

Addresses code review: sensitiveEnabled is now goroutine-safe via sync/atomic.
Extracted duplicate replaceAttr lambda to package-level function.
Updated spec to document that error/warn frontend messages are not redacted.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@0xMMA 0xMMA merged commit ea5db90 into main Apr 5, 2026
1 check passed
@0xMMA 0xMMA deleted the feat/unified-logging branch April 5, 2026 21:27
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.

Add log files

1 participant