-
Notifications
You must be signed in to change notification settings - Fork 49
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
Configure a custom zap logger #102
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
@lanzafame do you have any thoughts on this request/suggestion? |
@aschmahmann : are able to provide input on this? |
@moul sorry, for the slow reply, I have been on paternity leave. I am open to the addition of the SetZapLogger function. |
I wanted to do a PR for this issue, but from what I can see, it looks a bit more complicated. If I understand correctly, the proposed What do you think about adding a func SetPrimaryCore(core zapcore.Core) {
loggerMutex.Lock()
defer loggerMutex.Unlock()
if primaryCore != nil {
loggerCore.ReplaceCore(primaryCore, core)
} else {
loggerCore.AddCore(core)
}
primaryCore = core
} ? |
@MDobak The fix to this needs to both replace the existing and make sure that any new loggers use the provided |
@lanzafame The |
Hi,
We (@berty) are using zap extensively and improving our logging experience; we initialize our zap logger in a custom way:
Our current integration with ipfs/go-log is bad: https://github.com/berty/berty/blob/295bef9a6cced69feebf7b5e16525a112e74cdf8/go/cmd/berty/opts.go#L235-L254
I can open a PR against your repo to add new helpers, but I need to know if you accept changing the current API of your package and what kind of change you prefer
What about adding a new
SetZapLogger(*zap.Logger)
function, that I would use like this:Another solution is to accept custom
Options
so we can pass aWrapCore(customCore)
that go-log can chain in theNew
or within aWithOption
.What do you think? any better idea?
The text was updated successfully, but these errors were encountered: