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

Add WithOptions to SugaredLogger #1079

Merged
merged 3 commits into from
Apr 8, 2022
Merged

Add WithOptions to SugaredLogger #1079

merged 3 commits into from
Apr 8, 2022

Conversation

craigpastro
Copy link
Contributor

Closes #1072.

I added a simple test for this feature. One thought to add more comprehensive tests would be to replace the following line in the withSugar function in common_test.go:

withLogger(t, e, opts, func(logger *Logger, logs *observer.ObservedLogs) { f(logger.Sugar(), logs) })

with

withLogger(t, e, nil, func(logger *Logger, logs *observer.ObservedLogs) { f(logger.Sugar().WithOptions(opts...), logs) })

but maybe that is too much. WDYT?

Thank you!

@CLAassistant
Copy link

CLAassistant commented Apr 8, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@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.

Thanks!

sugar.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Apr 8, 2022

Codecov Report

Merging #1079 (ee70d37) into master (212dcb9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1079   +/-   ##
=======================================
  Coverage   98.20%   98.21%           
=======================================
  Files          49       49           
  Lines        2120     2123    +3     
=======================================
+ Hits         2082     2085    +3     
  Misses         29       29           
  Partials        9        9           
Impacted Files Coverage Δ
sugar.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 212dcb9...ee70d37. Read the comment docs.

@abhinav abhinav merged commit 1d435ba into uber-go:master Apr 8, 2022
@craigpastro craigpastro deleted the add-with-options-to-sugaredlogger branch April 8, 2022 17:18
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.

Add WithOptions() for SugaredLogger
3 participants