zap
zap copied to clipboard
zapslog: Support for a custom mapping of slog.Level to zap.Level
- Refs #1333
- Resolves #1412
summary
- enables custom mapping of slog.Level to zap.Level .
- If
zapslog.WithConvertLeveler
not given, the behavior is not changed.
tests
- passed test https://github.com/arukiidou/zap/pull/4
@sywhang please take a look?
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 98.63%. Comparing base (
8f5ee80
) to head (5a63490
). Report is 1 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #1413 +/- ##
=======================================
Coverage 98.63% 98.63%
=======================================
Files 53 54 +1
Lines 2997 3002 +5
=======================================
+ Hits 2956 2961 +5
Misses 32 32
Partials 9 9
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
The reason for drafting this Because I think it may be better to replace it with an implementation of slog.HandlerOptions#ReplaceAttr.
What do you think?
https://pkg.go.dev/log/slog#example-HandlerOptions-CustomLevels