Skip to content
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(handler): add methods to mutate and remove backtrace/spantrace #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gibfahn
Copy link

@gibfahn gibfahn commented Apr 18, 2023


Commits (oldest to newest)

d3da7e1 feat(handler): add methods to mutate and remove backtrace/spantrace

Fixes: #130


Comment on lines +25 to +33
/// Return a mutable reference to the captured `Backtrace` type
pub fn backtrace_mut(&mut self) -> Option<&mut Backtrace> {
self.backtrace.as_mut()
}

/// Remove the captured `Backtrace` if present.
pub fn clear_backtrace(&mut self) {
self.backtrace = None;
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially tried to use the .backtrace_mut() as in #130 (comment) , and it didn't work as it returns Option<&mut Backtrace> rather than &mut Option<Backtrace>.

I think that's more idiomatic rust, and so having two methods makes sense, but if you'd rather we delete clear_backtrace() and change the signature of backtrace_mut to:

pub fn backtrace_mut(&mut self) -> &mut Option<Backtrace> {

that works for me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Print a backtrace/spantrace to debug logs not to stderr
1 participant