-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log built-in rejections #1890
Log built-in rejections #1890
Conversation
axum-core/src/macros.rs
Outdated
target: "axum::rejection", | ||
tracing::Level::TRACE, | ||
status = $status.as_u16(), | ||
body = %$body_text, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why %
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question 🤔 it's not needed. I've removed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out it was needed after all https://github.com/tokio-rs/axum/actions/runs/4668640604/jobs/8266041087?pr=1890
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wut? Docs show that the impl exists: https://docs.rs/tracing/latest/tracing/trait.Value.html#impl-Value-for-String
Also, I think the default formatting for str
is equivalent to the ?debug
formatting rather than %display
formatting.
Co-authored-by: Jonas Platte <[email protected]>
This reverts commit d3dcc75.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get more clarity on the %display
thing in the tracing event before merging.
It complains about `impl Value for String` missing but that does exist https://docs.rs/tracing/latest/tracing/trait.Value.html#impl-Value-for-String
It's how you tell the tracing macro to use the values |
Yep that seems to have been it. The |
This enables logging of axum's built-in rejections, to make things easier to debug.
I also opted to merge the
define_rejection
andcomposite_rejection
macros that we had in axum-core and axum. That way we only have to update once place when changing the built-in rejections. Done in a separate commit.Example output:
TODO
fn body_text
.axum::rejection
target.tracing
feature default in axum, probably not in axum-core.