Skip to content

Why is it append instead of replace when adding fields #1361

Answered by abhinav
3tbraden asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @3tbraden. Yeah, this is a fair question.
Part of the reason for the choice is this: it's difficult to get the performance we want out of Zap by doing this with replace.
Particularly, note that With encodes keys at the time logger.With is called.
Going back and changing what's already been encoded to fix a duplicate would require decoding and re-encoding that blob.

There's also been some prior discussion about this in #622.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 3tbraden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants