mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 07:27:37 +00:00
improve code for tracing log
This commit is contained in:
+6
-6
@@ -335,20 +335,20 @@ async fn run(opt: config::Opt) -> Result<()> {
|
|||||||
span
|
span
|
||||||
})
|
})
|
||||||
.on_request(|request: &HttpRequest<_>, _span: &Span| {
|
.on_request(|request: &HttpRequest<_>, _span: &Span| {
|
||||||
debug!("started method: {}, url path: {}", request.method(), request.uri().path())
|
debug!("http started method: {}, url path: {}", request.method(), request.uri().path())
|
||||||
})
|
})
|
||||||
.on_response(|response: &Response<_>, latency: Duration, _span: &Span| {
|
.on_response(|response: &Response<_>, latency: Duration, _span: &Span| {
|
||||||
_span.record("status_code", tracing::field::display(response.status()));
|
_span.record("http response status_code", tracing::field::display(response.status()));
|
||||||
debug!("response generated in {:?}", latency)
|
debug!("http response generated in {:?}", latency)
|
||||||
})
|
})
|
||||||
.on_body_chunk(|chunk: &Bytes, latency: Duration, _span: &Span| {
|
.on_body_chunk(|chunk: &Bytes, latency: Duration, _span: &Span| {
|
||||||
debug!("sending {} bytes in {:?}", chunk.len(), latency)
|
debug!("http body sending {} bytes in {:?}", chunk.len(), latency)
|
||||||
})
|
})
|
||||||
.on_eos(|_trailers: Option<&HeaderMap>, stream_duration: Duration, _span: &Span| {
|
.on_eos(|_trailers: Option<&HeaderMap>, stream_duration: Duration, _span: &Span| {
|
||||||
debug!("stream closed after {:?}", stream_duration)
|
debug!("http stream closed after {:?}", stream_duration)
|
||||||
})
|
})
|
||||||
.on_failure(|_error, latency: Duration, _span: &Span| {
|
.on_failure(|_error, latency: Duration, _span: &Span| {
|
||||||
debug!("request error: {:?} in {:?}", _error, latency)
|
debug!("http request failure error: {:?} in {:?}", _error, latency)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.layer(CorsLayer::permissive())
|
.layer(CorsLayer::permissive())
|
||||||
|
|||||||
Reference in New Issue
Block a user