Skip to content

Commit

Permalink
Merge pull request #13 from WindSoilder/master
Browse files Browse the repository at this point in the history
add detail field for internal error
  • Loading branch information
eopb authored Aug 30, 2022
2 parents 8e18fe9 + 4a9e6ce commit 0790cd1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ impl TraceMiddleware {
info_span!("Response", http.status_code = status as u16, http.duration = ?duration)
.in_scope(|| {
if status.is_server_error() {
let span = error_span!("Internal error", error = field::Empty);
let span = error_span!(
"Internal error",
detail = field::Empty,
error = field::Empty
);
if let Some(error) = response.error() {
span.record("error", &field::display(error));
span.record("detail", &field::debug(error));
}
span.in_scope(|| error!("sent"));
} else if status.is_client_error() {
Expand Down

0 comments on commit 0790cd1

Please sign in to comment.