Skip to content
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

SugaredLogger: Turn error into zap.Error #1185

Merged
merged 4 commits into from Oct 15, 2022

Conversation

craigpastro
Copy link
Contributor

Resolves #1184.

Please let me know what you think! Thanks.

@codecov
Copy link

codecov bot commented Oct 6, 2022

Codecov Report

Merging #1185 (03bdfb2) into master (9137e0e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1185   +/-   ##
=======================================
  Coverage   98.34%   98.34%           
=======================================
  Files          49       49           
  Lines        2169     2178    +9     
=======================================
+ Hits         2133     2142    +9     
  Misses         28       28           
  Partials        8        8           
Impacted Files Coverage Δ
sugar.go 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@abhinav abhinav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks!

@mway @sywhang what do you think?

Copy link
Contributor

@sywhang sywhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Thanks for doing this work!

mway
mway approved these changes Oct 14, 2022
Copy link
Member

@mway mway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks! Couple of style nits, but otherwise lgtm.

sugar.go Outdated
fields := make([]Field, 0, len(args))
var invalid invalidPairs
var seenError bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's combine these into a var block

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Thank you. Done.

sugar_test.go Outdated
err := errors.New("qux")
context := []interface{}{"foo", "bar"}
extra := []interface{}{"baz", false}
expectedFields := []Field{String("foo", "bar"), Bool("baz", false)}
extra := []interface{}{err, "baz", false}
expectedFields := []Field{String("foo", "bar"), Error(err), Bool("baz", false)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's combine these into a var block here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combined into a var block here too. Thank you!

@sywhang sywhang merged commit 9b86a50 into uber-go:master Oct 15, 2022
3 of 5 checks passed
@craigpastro craigpastro deleted the turn-err-to-zap-error branch October 15, 2022 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

SugaredLogger: Turn error into zap.Error
4 participants