Trait sentry_contrib_native::BeforeSend
source · [−]pub trait BeforeSend: 'static + Send + Sync {
fn before_send(&self, value: Value) -> Value;
}
Expand description
Trait to help pass data to Options::set_before_send
.
Examples
struct Filter {
filtered: AtomicUsize,
};
impl BeforeSend for Filter {
fn before_send(&self, value: Value) -> Value {
self.filtered.fetch_add(1, Ordering::SeqCst);
// do something with the value and then return it
value
}
}
let mut options = Options::new();
options.set_before_send(Filter {
filtered: AtomicUsize::new(0),
});
let _shutdown = options.init()?;
Required methods
fn before_send(&self, value: Value) -> Value
fn before_send(&self, value: Value) -> Value
Before send callback.
Notes
The caller of this function will catch any unwinding panics and
abort
if any occured.
Examples
struct Filter {
filtered: AtomicUsize,
};
impl BeforeSend for Filter {
fn before_send(&self, value: Value) -> Value {
self.filtered.fetch_add(1, Ordering::SeqCst);
// do something with the value and then return it
value
}
}