You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 23, 2023. It is now read-only.
can a LazyLogger call Emit* functions more than once?
imo - yes
If yes, can each of those calls provide different keys?
yes, but a better question - can it provide the SAME keys? We have not specified a map or multi-map semantics for KV logging fields. I usually prefer multi-map, since the actual storage is just a list of k/v.
is it intentional that we don't know the key of the field
yes, it is intentional. The key of the lazy logger is meaningless since the logger itself does not have access to it when executed, yet it needs to provide the keys when calling methods on the Encoder.
Is it ok to call the LazyLogger if we just need the key (e.g. for Field.Key()?)
it will return empty string
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
There are some questions around LazyLogger that should be clarified in the comments:
Encoder.EmitLazyLogger
(as opposed to just calling theLazyLogger
directly); some motivation described in the discussion here: Add convenience methods Key() and Value() to log.Field #116 (comment)LazyLogger
callEmit*
functions more than once?LazyLogger
)?LazyLogger
if we just need the key (e.g. for Field.Key()?)The text was updated successfully, but these errors were encountered: