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

zapslog: Handler should ignore an empty Attr #1344

Merged
merged 1 commit into from
Sep 1, 2023

Conversation

abhinav
Copy link
Collaborator

@abhinav abhinav commented Sep 1, 2023

Per the slog.Handler contract,
handlers should not log attributes that are equal to the zero value.
This is equivalent to Zap's zap.Skip().

Discovered by #1335
Refs #1334

Per the slog.Handler contract,
handlers should not log attributes that are equal to the zero value.
This is equivalent to Zap's `zap.Skip()`.

Discovered by uber-go#1335
Refs uber-go#1334
@codecov
Copy link

codecov bot commented Sep 1, 2023

Codecov Report

Merging #1344 (910c4cd) into master (98e9c4f) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1344      +/-   ##
==========================================
+ Coverage   97.77%   97.80%   +0.03%     
==========================================
  Files          51       51              
  Lines        3366     3369       +3     
==========================================
+ Hits         3291     3295       +4     
+ Misses         65       63       -2     
- Partials       10       11       +1     
Files Changed Coverage Δ
exp/zapslog/handler.go 93.00% <100.00%> (+6.40%) ⬆️

... and 1 file with indirect coverage changes

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

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.

👍

@sywhang sywhang merged commit e9f4bda into uber-go:master Sep 1, 2023
5 checks passed
@abhinav abhinav deleted the slog-ignore-empty-attr branch September 1, 2023 18:44
prashantv added a commit to prashantv/zap that referenced this pull request Sep 9, 2023
Follow-up to uber-go#1344 to handle empty attributes using a skip field
in a single place, so each caller of `convertAttrToField` doesn't
have to check for empty attributes explicitly.
abhinav pushed a commit that referenced this pull request Sep 9, 2023
Follow-up to #1344 to handle empty attributes using a skip field in a
single place, so each caller of `convertAttrToField` doesn't have to
check for empty attributes explicitly.
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.

2 participants