zap icon indicating copy to clipboard operation
zap copied to clipboard

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

Open arukiidou opened this issue 6 months ago • 3 comments

  • 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

arukiidou avatar Feb 07 '24 14:02 arukiidou

@sywhang please take a look?

arukiidou avatar Feb 26 '24 14:02 arukiidou

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.

codecov[bot] avatar Mar 12 '24 18:03 codecov[bot]

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

arukiidou avatar Apr 02 '24 22:04 arukiidou