mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-07 00:00:15 +02:00
fix: add tracing calls to tracing-aka-logging example closures (#3722)
This commit is contained in:
@@ -65,21 +65,22 @@ async fn main() {
|
||||
// You can use `_span.record("some_other_field", value)` in one of these
|
||||
// closures to attach a value to the initially empty field in the info_span
|
||||
// created above.
|
||||
tracing::debug!("started processing request")
|
||||
})
|
||||
.on_response(|_response: &Response, _latency: Duration, _span: &Span| {
|
||||
// ...
|
||||
tracing::debug!("finished processing request")
|
||||
})
|
||||
.on_body_chunk(|_chunk: &Bytes, _latency: Duration, _span: &Span| {
|
||||
// ...
|
||||
tracing::debug!("sending body chunk")
|
||||
})
|
||||
.on_eos(
|
||||
|_trailers: Option<&HeaderMap>, _stream_duration: Duration, _span: &Span| {
|
||||
// ...
|
||||
tracing::debug!("stream closed")
|
||||
},
|
||||
)
|
||||
.on_failure(
|
||||
|_error: ServerErrorsFailureClass, _latency: Duration, _span: &Span| {
|
||||
// ...
|
||||
tracing::error!("something went wrong")
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user