-
Notifications
You must be signed in to change notification settings - Fork 35
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
fix(leak): Avoid mutating logger #97
fix(leak): Avoid mutating logger #97
Conversation
r.Use(SetLogger( | ||
WithLogger(func(*gin.Context, zerolog.Logger) zerolog.Logger { return l }), | ||
WithLogger(func(_ *gin.Context, l zerolog.Logger) zerolog.Logger { return l.Output(buffer).With().Logger() }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why this was not caught by this test is because the modifications to the logger basically add method
, path
, ip
, and user_agent
which are ALSO added to the event, but without json it seems to dedupe these keys.
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #97 +/- ##
==========================================
+ Coverage 94.24% 94.40% +0.16%
==========================================
Files 2 2
Lines 139 143 +4
==========================================
+ Hits 131 135 +4
Misses 5 5
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
@pablomatiasgomez Thanks |
@appleboy Any ideas when this would be released? Thanks!! |
Same as what happened in #69, the same bug was introduced later, in #76
The only reason this was not caught by the test
TestCustomLoggerIssue68
is because that feature is usingl
instead ofrl
so it's not even working correctly for custom loggers.cc @appleboy