pub fn parent<P>(matches: P) -> ParentPredicate<P>where
P: for<'a> Predicate<CapturedSpan<'a>>,
Expand description
Creates a predicate for the direct parent CapturedSpan
of a span or a CapturedEvent
.
ยงExamples
let storage = SharedStorage::default();
let subscriber = Registry::default().with(CaptureLayer::new(&storage));
tracing::subscriber::with_default(subscriber, || {
tracing::info_span!("compute").in_scope(|| {
tracing::info!(answer = 42, "done");
});
});
let storage = storage.lock();
let parent_pred = level(Level::INFO) & name(eq("compute"));
let _ = storage.scan_events().single(&parent(parent_pred));