Skip to content

Commit

Permalink
feat(handler): add methods to mutate and remove backtrace/spantrace
Browse files Browse the repository at this point in the history
  • Loading branch information
gibfahn committed Apr 18, 2023
1 parent 4a7b4d6 commit b681cce
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,37 @@ impl Handler {
self.backtrace.as_ref()
}

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

/// Return a reference to the captured `Backtrace` type
pub fn clear_backtrace(&mut self) {
self.backtrace = None;
}

/// Return a reference to the captured `SpanTrace` type
#[cfg(feature = "capture-spantrace")]
#[cfg_attr(docsrs, doc(cfg(feature = "capture-spantrace")))]
pub fn span_trace(&self) -> Option<&SpanTrace> {
self.span_trace.as_ref()
}

/// Return a reference to the captured `SpanTrace` type
#[cfg(feature = "capture-spantrace")]
#[cfg_attr(docsrs, doc(cfg(feature = "capture-spantrace")))]
pub fn span_trace_mut(&mut self) -> Option<&mut SpanTrace> {
self.span_trace.as_mut()
}

/// Return a reference to the captured `SpanTrace` type
#[cfg(feature = "capture-spantrace")]
#[cfg_attr(docsrs, doc(cfg(feature = "capture-spantrace")))]
pub fn clear_span_trace(&mut self) {
self.span_trace = None;
}

pub(crate) fn format_backtrace<'a>(
&'a self,
trace: &'a backtrace::Backtrace,
Expand Down

0 comments on commit b681cce

Please sign in to comment.