Skip to content

Move zap adapter to a separate module, add slog adapter - #46

Merged
Insei merged 4 commits into
mainfrom
logger-modules
Oct 16, 2026
Merged

Insei merged 4 commits into
mainfrom
logger-modules

Conversation

@Insei

@Insei Insei commented Oct 16, 2026

Copy link
Copy Markdown
Owner

zap was a dependency of the core only because of the bundled adapter, every application got zap and its dependencies even with another logger.

  • The zap adapter is moved to the separate module github.com/insei/tinyconf/logger/zaplogger: zaplogger.New(*zap.Logger). go.uber.org/zap is removed from the go.mod of tinyconf.
  • New logger.NewSlogLogger(*slog.Logger) in the core, in a file with //go:build go1.21: the minimal Go of the core is still 1.19, the adapter exists for Go 1.21+.
  • CI tests the new module and uploads its coverage to Codecov.

Breaking change: logger.NewZapLogger(l) → zaplogger.New(l) from the new module; the docs have the migration note. The new module needs its own tag on release: logger/zaplogger/v1.0.0.

Insei added 4 commits October 16, 2026 15:18
…gger, zap is not a dependency of the core

Signed-off-by: Dmitriy Aleksandrov <goodmobiledevices@gmail.com>
Signed-off-by: Dmitriy Aleksandrov <goodmobiledevices@gmail.com>
Signed-off-by: Dmitriy Aleksandrov <goodmobiledevices@gmail.com>
Signed-off-by: Dmitriy Aleksandrov <goodmobiledevices@gmail.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ba64f6e) to head (78ba60a).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #46   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           30        31    +1     
  Lines         2571      2582   +11     
=========================================
+ Hits          2571      2582   +11     

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark diff: ba64f6e → 5a81b8b (10 runs)

goos: linux
goarch: amd64
pkg: github.com/insei/tinyconf
cpu: AMD EPYC 9V74 80-Core Processor                
                    │  base.txt   │              head.txt              │
                    │   sec/op    │   sec/op     vs base               │
Parse-4               5.989µ ± 1%   6.135µ ± 1%  +2.44% (p=0.001 n=10)
Parse_SubConfig-4     2.179µ ± 1%   2.216µ ± 0%  +1.68% (p=0.000 n=10)
Current-4             42.87n ± 1%   42.83n ± 0%       ~ (p=0.698 n=10)
Current_SubConfig-4   77.15n ± 0%   77.03n ± 0%       ~ (p=0.118 n=10)
geomean               455.8n        460.2n       +0.96%

                    │    base.txt    │               head.txt                │
                    │      B/op      │     B/op      vs base                 │
Parse-4               4.899Ki ± 0%     4.899Ki ± 0%       ~ (p=1.000 n=10)
Parse_SubConfig-4     1.367Ki ± 0%     1.367Ki ± 0%       ~ (p=1.000 n=10) ¹
Current-4               0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
Current_SubConfig-4     0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                            ²                 +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                    │   base.txt   │              head.txt               │
                    │  allocs/op   │ allocs/op   vs base                 │
Parse-4               139.0 ± 0%     139.0 ± 0%       ~ (p=1.000 n=10) ¹
Parse_SubConfig-4     44.00 ± 0%     44.00 ± 0%       ~ (p=1.000 n=10) ¹
Current-4             0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Current_SubConfig-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                          ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

pkg: github.com/insei/tinyconf/drivers
                │  base.txt   │           head.txt            │
                │   sec/op    │   sec/op     vs base          │
Parse_Drivers-4   50.76µ ± 1%   50.36µ ± 2%  ~ (p=0.075 n=10)

                │   base.txt   │            head.txt            │
                │     B/op     │     B/op      vs base          │
Parse_Drivers-4   32.04Ki ± 0%   32.04Ki ± 0%  ~ (p=0.474 n=10)

                │  base.txt  │            head.txt            │
                │ allocs/op  │ allocs/op   vs base            │
Parse_Drivers-4   645.0 ± 0%   645.0 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

@Insei
Insei merged commit 06f1253 into main Oct 16, 2026
4 checks passed
@Insei
Insei deleted the logger-modules branch October 16, 2026 12:21
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