-
Notifications
You must be signed in to change notification settings - Fork 333
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
feat: stack trace style debug print for error #2489
Conversation
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #2489 +/- ##
===========================================
- Coverage 85.02% 84.64% -0.39%
===========================================
Files 724 725 +1
Lines 115337 115542 +205
===========================================
- Hits 98071 97800 -271
- Misses 17266 17742 +476 |
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
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.
LGTM
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.
Since this PR is easy to conflict with others, I decided to merge it first.
We could implement the enhancement mentioned in #2489 (comment) later
* impl macro stack_trace_debug Signed-off-by: Ruihang Xia <[email protected]> * manually mark external error Signed-off-by: Ruihang Xia <[email protected]> * ignore warnings Signed-off-by: Ruihang Xia <[email protected]> * fix clippy warnings Signed-off-by: Ruihang Xia <[email protected]> * use debug print Signed-off-by: Ruihang Xia <[email protected]> * simplify the error and warn macro Signed-off-by: Ruihang Xia <[email protected]> * fix ut Signed-off-by: Ruihang Xia <[email protected]> * add docs Signed-off-by: Ruihang Xia <[email protected]> * replace snafu backtrace with location Signed-off-by: Ruihang Xia <[email protected]> --------- Signed-off-by: Ruihang Xia <[email protected]>
I hereby agree to the terms of the GreptimeDB CLA
What's changed and what's your intention?
TL;DR
Change the error logging style to
(by
error!
macro)(by debug print)
And the previous one looks like
How to use
Take
cmd/error.rs
as an example:Only a few things to notice:
Debug
manually, the new macrostack_trace_debug
will generate one that can print the error prettier#[stack_trace_debug]
to every error enumerror
and add a snafu annotation#[snafu(source)]
.todo
location_opt
Checklist
Refer to a related PR or issue link (optional)