Function sentry::add_breadcrumb [] [src]

pub fn add_breadcrumb<F: FnOnce() -> Breadcrumb>(f: F)

Records a breadcrumb by calling a function.

The total number of breadcrumbs that can be recorded are limited by the configuration on the client. This takes a callback because if the client is not interested in breadcrumbs none will be recorded.

Example

use sentry::protocol::{Breadcrumb, Map};

sentry::add_breadcrumb(|| Breadcrumb {
    ty: "http".into(),
    category: Some("request".into()),
    data: {
        let mut map = Map::new();
        map.insert("method".into(), "GET".into());
        map.insert("url".into(), "https://example.com/".into());
        map
    },
    ..Default::default()
});