Available on crate feature
tracing only.Expand description
Logs every request with tracing (feature tracing).
TraceLayer opens a http.request span per request, with the method and the URL without its query (a query can
hold an API key), and records the status and duration when the response arrives:
- a response below
500: an event atDEBUG; - a
5xxresponse or a failure to send: an event atWARN.
Events have the target timvw_rust_runtime::trace, so RUST_LOG=timvw_rust_runtime=debug shows every request.
With the retry feature, RetryPolicy logs each retry at DEBUG too.
use timvw_rust_runtime::{trace::TraceLayer, Client};
let client = Client::default().layer(TraceLayer::new());Headers and bodies are not logged. For more (headers, custom spans, OpenTelemetry), use tower-http’s
TraceLayer; it works with Client::layer too.
Structs§
- Trace
Layer - A tower layer that logs each request and its outcome. See the module documentation.
- Trace
Service - The service of a
TraceLayer.