You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has been fixed with #409 and #499 by changing WithContext to not be pointer receiver and keeping Logger to be value receiver. I think this could be closed unless we want to discuss making all methods be of the same receiver type (also opened in #563).
As per the documentation for
zerolog
, using contexts to pass sub-loggers should work something like this:This doesn't work, however, since the
Logger()
method onContext
returns a non-pointer andWithContext(context.Context)
requires a pointer receiver.I have had to use a workaround that looks like this:
It works, but is not pretty.
Were there any major design considerations for using a non-pointer receiver for
Logger()
?I'm more than happy to create the PR to change this if you agree that it's a good idea.
The text was updated successfully, but these errors were encountered: