Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zapslog: Support for a custom mapping of slog.Level to zap.Level #1413

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

arukiidou
Copy link
Contributor

@arukiidou arukiidou commented Feb 7, 2024

summary

  • enables custom mapping of slog.Level to zap.Level .
  • If zapslog.WithConvertLeveler not given, the behavior is not changed.

tests

@arukiidou arukiidou marked this pull request as ready for review February 8, 2024 10:20
@arukiidou
Copy link
Contributor Author

@sywhang please take a look?

Copy link
Contributor

@zekth zekth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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           

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

@arukiidou arukiidou marked this pull request as draft March 27, 2024 11:33
@arukiidou
Copy link
Contributor Author

arukiidou commented Apr 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

zapslog: Support for a custom mapping of slog.Level to zap.Level
3 participants