refactor: unify logging with log/slog #110

Merged
lerko merged 1 commits from refactor/slog-logging into main 2026-06-11 22:09:54 +00:00
Owner

Summary

Phase 5d — final architectural item. Replaces three uncoordinated logging systems with structured log/slog.

68 calls migrated:

  • log.Printf (45 calls) → slog.Error/Warn/Info across server, store, cluster, main
  • fmt.Fprintf(os.Stderr) (23 calls) → slog.Error in main.go

Kept unchanged:

  • fmt.Println/Printf for CLI user output (version, banners, import results)
  • engine.AddLog for TUI-visible ring buffer (monitoring events, not system logs)

Improvements:

  • Structured key-value attributes instead of format strings
  • Proper log levels: Error for failures, Warn for config issues, Info for status, Debug for migrations
  • HTTP request logging now structured (method, path, status, duration, ip)
  • Store migration diagnostics demoted to Debug (silent at default info level)
  • Zero log.Printf or fmt.Fprintf(os.Stderr) remaining in production code

Test plan

  • go test -race ./... — all pass
  • golangci-lint — 0 issues
  • Zero log.Printf remaining (grep verified)
  • Zero fmt.Fprintf(os.Stderr) remaining (grep verified)
## Summary Phase 5d — final architectural item. Replaces three uncoordinated logging systems with structured `log/slog`. **68 calls migrated:** - `log.Printf` (45 calls) → `slog.Error`/`Warn`/`Info` across server, store, cluster, main - `fmt.Fprintf(os.Stderr)` (23 calls) → `slog.Error` in main.go **Kept unchanged:** - `fmt.Println`/`Printf` for CLI user output (version, banners, import results) - `engine.AddLog` for TUI-visible ring buffer (monitoring events, not system logs) **Improvements:** - Structured key-value attributes instead of format strings - Proper log levels: Error for failures, Warn for config issues, Info for status, Debug for migrations - HTTP request logging now structured (method, path, status, duration, ip) - Store migration diagnostics demoted to Debug (silent at default info level) - Zero `log.Printf` or `fmt.Fprintf(os.Stderr)` remaining in production code ## Test plan - [x] `go test -race ./...` — all pass - [x] `golangci-lint` — 0 issues - [x] Zero `log.Printf` remaining (grep verified) - [x] Zero `fmt.Fprintf(os.Stderr)` remaining (grep verified)
lerko added 1 commit 2026-06-11 22:04:43 +00:00
refactor: unify logging with log/slog
CI / test (pull_request) Successful in 1m57s
CI / lint (pull_request) Successful in 1m22s
CI / vulncheck (pull_request) Successful in 56s
341d60d2fe
Replace three uncoordinated logging systems (log.Printf, fmt.Fprintf
to stderr, fmt.Println warnings) with structured slog calls.

68 log calls migrated:
- log.Printf → slog.Error/Warn/Info (45 calls across 5 files)
- fmt.Fprintf(os.Stderr) → slog.Error (23 calls in main.go)

Kept unchanged:
- fmt.Println/Printf for CLI user output (version, banners, import results)
- engine.AddLog for TUI-visible ring buffer (monitoring events)

Store migration diagnostics demoted to slog.Debug (silent at default
info level). HTTP request logging now structured with method/path/
status/duration/ip attributes.
lerko merged commit 341d60d2fe into main 2026-06-11 22:09:54 +00:00
lerko deleted branch refactor/slog-logging 2026-06-11 22:09:54 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lerkolabs/uptop#110