Skip to main content

Module tracing_middleware

Module tracing_middleware 

Source
Expand description

Middleware for logging HTTP request/response details at TRACE level.

Logs request method, URL, headers, request body, and response status and headers. All output is at TRACE level so it is silent unless the subscriber is configured to capture TRACE spans for this crate.

Each request is wrapped in an http_request span with a unique request_id, making it easy to correlate request/response log lines when multiple requests are in flight.

Sensitive headers (Authorization, Cookie, Set-Cookie, Proxy-Authorization) are redacted in the log output.

ยงWarning

At TRACE level this will include request body payloads. Only enable TRACE logging in development environments.

Structsยง

ReqwestTracingMiddleware
Reqwest middleware that logs HTTP request and response details via tracing at TRACE level.

Constantsยง

MAX_REQUEST_BODY_LOG_SIZE ๐Ÿ”’
REDACTED_HEADERS ๐Ÿ”’

Functionsยง

is_sensitive ๐Ÿ”’