-
Notifications
You must be signed in to change notification settings - Fork 13
Support structured logging (KV) #77
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
base: main-dev
Are you sure you want to change the base?
Conversation
c7f733a
to
fa762d4
Compare
36434c6
to
5a22c32
Compare
96fa68b
to
8111ba7
Compare
6869460
to
c3850e8
Compare
a6f1e40
to
6a65557
Compare
6285053
to
98e1cd3
Compare
0b73c22
to
02d3f77
Compare
I think this PR is ready. @Lancern Would you like to take a look? Any concerns or considerations? |
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.
Copilot reviewed 32 out of 32 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
spdlog/src/formatter/journald_formatter.rs:52
- Consider adding a separator between the payload and the key-values (e.g. a whitespace) to ensure the log output is clearly delimited.
record.key_values().write_to(dest, true)?;
Just found and tried the new GitHub feature - requesting reviews from Copilot, but the results is a false-positive :( |
Implementation of #70, working in progress.
Steps
kv::Key
andkv::Value
value-bag
directly (alias) for value first.kvs
field tostruct Record
.kv
optional parameter.kv
is optional, just like the existinglogger
argument, and I may wish to allow them to be in any order. The colon allows us to distinguish with the formatting arguments so that it can be placed anywhere.FullFormatter
.PatternFormatter
.Simply adding a new{kv}
pattern to output like"{ k1=1, k2=text }"
"k1=1 k2=text"
, separated by whitespace, and brackets are not added by default (users can easily opt-in to add brackets themselves)kv
field inJsonFormatter
.Try to replace slice withphf
map for KV. (self-reminder: benchmarking it..)phf
only supports limited types for key (doc), and we have a custom typekv::Key
, so abandon the idea.log
crate's KV.Clone
forkv::Value
rust-lang/log#668Merged, waiting for a release. Prepare for 0.4.26 release rust-lang/log#670
log
crate.sval
andserde
.Record
,downcasting(see doc ofvalue-bag
), etc.).sval_buffer
to v2.3 sval-rs/value-bag#97Merged, waiting for a release.