Conversion from log::kv::Value to Option<Vec<String>> #535
Labels
No labels
bug
duplicate
easy
enhancement
help wanted
invalid
question
rfc
structured-logging
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-rust-lang/log#535
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello!
I am implementing a custom logger that prints a JSON serialized struct. The struct has a field
custom_list: Option<Vec<String>>that should be derived fromlog::kv::Value. However I could not figure out how to convert toVec<String>fromValue? Is that a missing feature or am I overseeing something here?From end users perspective:
info!(custom_list = as_serde!(vec!["a".to_string(), "b".to_string()]); "Test log msg");Thanks
This is quite a useful thing to be able to do, and is currently a feature gap in
log. The underlying library that supportslog::kv::Valuedid just recently get some support for pulling sequences from values: https://docs.rs/value-bag/latest/value_bag/struct.ValueBag.html#method.to_str_seq.We could try come up with an API that makes sense for
log::kv::Valuetoo.For what it's worth, issue #641 inquires about a more generic way to solve this and other similar conversion needs.