[][src]Function warp::filters::trace::trace

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

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(),
        )
    }));