Skip to content

refactor: migrate from zap to log/slog#210

Merged
dmke merged 1 commit intomasterfrom
refactor/slog-v2
Apr 11, 2026
Merged

refactor: migrate from zap to log/slog#210
dmke merged 1 commit intomasterfrom
refactor/slog-v2

Conversation

@dmke
Copy link
Copy Markdown
Member

@dmke dmke commented Apr 11, 2026

Replace go.uber.org/zap logging with Go's standard log/slog package throughout the codebase. Introduces thin wrapper module (xlog) that provides a simplified interface around slog with:

  • Logger interface with Debug/Info/Warn/Error/Fatal methods
  • Functional options pattern for configuration
  • Support for both text (via slogor) and JSON handlers
  • Convenience attribute generators (String, Int, Error, etc.)
  • Test utilities (MockClock, Discard)

Notable Changes:

  • add xlog/ module with wrapper implementation and tests
  • migrate all packages
  • update logger setup in cmd/texd/ to use xlog
  • adapt all test files to use xlog.NewDiscard() and test helpers

Fixes: #1
Closes: #108

@dmke dmke mentioned this pull request Apr 11, 2026
4 tasks
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

❌ Patch coverage is 85.84475% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.64%. Comparing base (0779dbc) to head (7b2d7c0).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
service/renderer.go 43.75% 9 Missing ⚠️
cmd/texd/setup.go 66.66% 5 Missing ⚠️
cmd/texd/signals.go 0.00% 4 Missing ⚠️
service/service.go 57.14% 3 Missing ⚠️
xlog/discard.go 75.00% 3 Missing ⚠️
xlog/xlog.go 94.54% 3 Missing ⚠️
refstore/nop/nop_store.go 0.00% 2 Missing ⚠️
cmd/texd/main.go 0.00% 1 Missing ⚠️
service/middleware/logging.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #210      +/-   ##
==========================================
+ Coverage   78.47%   79.64%   +1.16%     
==========================================
  Files          39       43       +4     
  Lines        1719     1837     +118     
==========================================
+ Hits         1349     1463     +114     
- Misses        300      305       +5     
+ Partials       70       69       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Replace go.uber.org/zap logging with Go's standard log/slog package
throughout the codebase. Introduces thin wrapper module (xlog) that
provides a simplified interface around slog with:

- Logger interface with Debug/Info/Warn/Error/Fatal methods
- Functional options pattern for configuration
- Support for both text (via slogor) and JSON handlers
- Convenience attribute generators (String, Int, Error, etc.)
- Test utilities (MockClock, Discard)

Notable Changes:
- add xlog/ module with wrapper implementation and tests
- migrate all packages
- update logger setup in cmd/texd/ to use xlog
- adapt all test files to use xlog.NewDiscard() and test helpers

Fixes: #1
@dmke dmke force-pushed the refactor/slog-v2 branch from d254cc1 to 7b2d7c0 Compare April 11, 2026 20:02
@dmke dmke merged commit 6afa886 into master Apr 11, 2026
5 checks passed
@dmke dmke deleted the refactor/slog-v2 branch April 11, 2026 20:14
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.

Log improvements

1 participant