Open Sherlock-Holo opened 3 years ago
I think you should use tracing::info!(?base_req)
or tracing::info!(%base_req)
. See https://tracing.rs/tracing/index.html#recording-fields
@Folyd these ways only print the struct as string, not like slog::KV
A quick note: there's some discussion in the Tokio Discord in the #valuable
channel on rethinking the Value trait. At the moment, the discussion focused on requirements.
Feature Request
Crates
tracing
Motivation
consider we have a request base info like
for now when we print log with messages in the
BaseRequest
, we have to useif we write many logs we have to write the
xxx = yyy
many times, it makes me so sad.if tracing add a new trait like slog::KV, we can print log easily like
info!(extra_key = extra_value, base_req, "message")
Proposal
add a new trait like slog::KV
the
BaseRequest
can implement this traitAlternatives