-
Hi, I'm using
My
My question is how do I include this field in the object encoder for
|
Beta Was this translation helpful? Give feedback.
Answered by
abhinav
Mar 30, 2022
Replies: 1 comment
-
If you have a func (o Order) MarshalLogObject(enc zapcore.ObjectEncoder) error {
enc.AddString("id", o.ID)
enc.AddInt64("price", o.Price)
zap.Strings("keywords", o.Keywords).AddTo(enc)
// ...
} Hope this helps! |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
abhinav
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have a
[]string
inside a ObjectMarshaler implementation,you can re-use the
zap.Strings
field constructorand add it to the encoder with
Field.AddTo
.Hope this helps!