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

Is it possible to check whether a field is already defined and either drop it or overwrite it? #1025

Closed
polds opened this issue Nov 6, 2021 · 1 comment

Comments

@polds
Copy link

polds commented Nov 6, 2021

I'm wondering if it's possible check whether a field is already defined. I find some log entries get to the point where the same context is defined multiple times throughout the stack so you end up with {"i": "foo", "i": "foo", "i": "foo"}, etc.

Is it possible (maybe with a Hook?) to check if the field is already present and decide whether to not log, or overwrite the field?

If a Hook is the answer I'm not sure what that would look like.

@abhinav
Copy link
Collaborator

abhinav commented Nov 10, 2021

Hey, sorry it's not possible to detect this in Zap today.

This came up in #622 before and that issue has some ideas on
what Zap could do internally to detect and prevent this.
However, we've generally not prioritized that feature because
we don't frequently see intentionally duplicate keys in production often.
And for the unintentional duplicates, we'd rather have the issue found and fixed rather than ignored.

Closing in favor of #622

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants