Function sentry::capture_event
source · pub fn capture_event(event: Event<'static>) -> Uuid
Expand description
Captures an event on the currently active client if any.
The event must already be assembled. Typically code would instead use
the utility methods like capture_message
, capture_error
, or an
integration specific function.
The return value is the event ID. If the event was discarded for any reason,
return value will be the nil UUID (Uuid::nil
).
§Examples
use sentry::protocol::{Event, Level};
use sentry::types::Uuid;
let uuid = Uuid::new_v4();
let event = Event {
event_id: uuid,
message: Some("Hello World!".into()),
level: Level::Info,
..Default::default()
};
assert_eq!(sentry::capture_event(event.clone()), Uuid::nil());
let events = sentry::test::with_captured_events(|| {
assert_eq!(sentry::capture_event(event), uuid);
});
assert_eq!(events.len(), 1);