-
Notifications
You must be signed in to change notification settings - Fork 574
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 phsym/zeroslog breakage due to rs/zerolog v1.32.0 #653
Conversation
Would #575 let you solve your issue? |
It fixes part of the problem. The other part would then just require a |
Couldn't you use |
TL;DR You're right, #575 would solve the more difficult part of my problem and existing methods on My original work-around PR addressing I guess I considered my use of |
Yes I think |
Thanks. Looking forward to #575. |
This is no longer necessary AFAIK. It would be nice to get a |
Done |
Thanks! I've pushed a PR to |
@madkins23 have you considered submitting a PR to integrate your slog support in zerolog itself? |
Not really. I'm not actually part of the I did comment on doing something like this in #571 but I phrased it as Let me think about it a bit. I might take a whack at it after I get through with the current set of tweaks to my test harness. |
TL;DR Add function to create a zerolog.Context object with a logger copy and clear the copy's context byte array in order to fix breakage in
phsym/zeroslog
.The recent release of
rs/zerolog v1.32.0
brokephsym/zeroslog
. The latter was creating blankzerolog.Context
objects in several places and they worked fine up throughrs/zerolog v1.31.0
. I documented the issue in aphsym/zeroslog
PR, wherein I provided a potential solution to the issue that didn't require any changes tors/zerolog
.This PR provides a (hopefully) minor change to
rs/zerolog
that makes fixingphsym/zeroslog
simpler. I have already filed a second presumptivephsym/zeroslog
PR dependent on the changes in thisrs/zerolog
PR.Hopefully this PR will be an acceptable and minor change.
I gave the new function a long name because it is combining two issues. It could be broken down into:
NewContext(logger Logger)
which would just create the new
zerolog.Context
object with a logger and(l Logger) ClearContext()
which would clear the
context
byte array on the copiedLogger
.These two calls could be used instead of the single
NewContextWithResetLogger
call, something like this:If the latter is preferable I can generate a different PR.