-
Notifications
You must be signed in to change notification settings - Fork 8
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
Disable zap by default #27
Comments
Signed-off-by: Timon Wong <[email protected]>
Oops I re-checked the code your point out. OK. now I got your point. the code you point out is a special case. someone use a zap sugared logger and then write zap core like this: logger, _ := zap.NewProduction()
defer logger.Sync() // flushes buffer, if any
sugar := logger.Sugar()
sugar.Infow("failed to fetch URL",
zap.String("url", url),
"attempt", 3,
"backoff", time.Second,
) OK, in current linter implemention, this should got false positives |
but I think use a zap if the linter point that out, that should be a good thing ? not a bug. one should use zap core logger, it they like to write |
@ttys3 ok, for most use cases our check is just ok. However I'll try to implement a special checker for zap instead, when my hands free |
fix #27 Signed-off-by: Timon Wong <[email protected]>
fix #27 Signed-off-by: Timon Wong <[email protected]>
Fixes #27 Signed-off-by: Timon Wong <[email protected]>
Signed-off-by: Timon Wong <[email protected]>
By inspecting the zap implementation:
https://github.com/uber-go/zap/blob/0d6a75bccff91a3106f193c9e4e1678738a63f9d/sugar.go#L339-L342
We can see in zap sugar logger, the keys and values can work without pairs (using "Fields" instead)
So in order to reduce the opportunity of false positives, we should disable it by default.
@ttys3 What do you think?
The text was updated successfully, but these errors were encountered: