Closed OliverNChalk closed 11 months ago
First you need to enable the tracing_unstable
rustc flag and the valuable
feature in the tracing
crate. Ref.
Then you need to call .as_value()
on the value before using a tracing macro, e.g.:
tracing::info!(service = service.as_value(), "Service unit removed");
I was expecting valuable to work out of the box with tracing's macros (
info
,debug
etc). However, I get an issue sayingValue
is not implemented for my type (i.e. there is no blanket implementation covering all types that implement Valuable). This currently seems like the only way to make tracing happy:Please let me know if this was an oversight, or if there's a fundamental limitation preventing the compiler from auto-coercing my type (
RemoteServiceId
) that implements Valuable to Value?