id

Function id 

Source
pub fn id() -> Uuid
Available on crate feature uuid only.
Expand description

Gets the current Uuid of an entered span within a tracing-forest subscriber.

§Examples

Passing in a Uuid to a span, and then retreiving it from within the span:

let uuid = Uuid::new_v4();

// Tracing's syntax allows us to omit the redundent naming of the field here
info_span!("my_span", %uuid).in_scope(|| {
    assert!(tracing_forest::id() == uuid);
});

§Panics

This function panics if there is no current subscriber, if the subscriber isn’t composed with a ForestLayer, or if the subscriber isn’t in a span.