Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
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