Skip to content

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

Draft
arukiidou wants to merge 6 commits into
uber-go:masterfrom
arukiidou:feature/custom-mapping-level
Draft

zapslog: Support for a custom mapping of slog.Level to zap.Level#1413
arukiidou wants to merge 6 commits into
uber-go:masterfrom
arukiidou:feature/custom-mapping-level

Conversation

@arukiidou

@arukiidou arukiidou commented Feb 7, 2024

Copy link
Copy Markdown
Contributor

summary

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

tests

Signed-off-by: junya koyama <arukiidou@yahoo.co.jp>
@arukiidou
arukiidou marked this pull request as ready for review February 8, 2024 10:20
@arukiidou

Copy link
Copy Markdown
Contributor Author

@sywhang please take a look?

@zekth zekth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@codecov

codecov Bot commented Mar 12, 2024

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.63%. Comparing base (8f5ee80) to head (5a63490).
⚠️ Report is 39 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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arukiidou
arukiidou marked this pull request as draft March 27, 2024 11:33
@arukiidou

arukiidou commented Apr 2, 2024

Copy link
Copy Markdown
Contributor Author

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