-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Add basic key-value pair field support #3
Conversation
Thank you for your submission @lpraneis! I'll have a look and provide feedback shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you again! I spent some time thinking about how to serialize slog's key/value pairs "natively" but couldn't think of a way as tracking handles these quite differently.
Would you mind calling this addition kv
instead of fields
? That name is quite overloaded in the context of tracing.
Also, I'd prefer the whole feature to be opt-in, for starters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful, thank you!
Co-authored-by: Peter Nehrer <pnehrer@eclipticalsoftware.com>
Co-authored-by: Peter Nehrer <pnehrer@eclipticalsoftware.com>
Hi @pnehrer , thanks for the useful crate!
I recently used this crate in a project that made heavy use of the
slog
support for key value pairs and added some basic support to this library for serializing those to a new field,slog.fields
and thought I would contribute that change upstream in case it would be useful for others as well.Feel free to decline this PR if you don't think this kind of addition makes sense here. I gated the new functionality behind a
kv
feature because it does have some slight allocation overhead per log generated if a key-value pair is in use. I made this feature opt-out but would be happy to swap that to opt-in.