Function warp::filters::trace::trace

source ·
pub fn trace<F>(func: F) -> Trace<F>
where F: Fn(Info<'_>) -> Span + Clone,
Expand description

Create a wrapping filter that instruments every request with a custom tracing Span provided by a function.

§Example

use warp::Filter;

let route = warp::any()
    .map(warp::reply)
    .with(warp::trace(|info| {
        // Create a span using tracing macros
        tracing::info_span!(
            "request",
            method = %info.method(),
            path = %info.path(),
        )
    }));