diff --git a/tracing-subscriber/src/fmt/fmt_subscriber.rs b/tracing-subscriber/src/fmt/fmt_subscriber.rs index 9e23a301ac..51f1592ed8 100644 --- a/tracing-subscriber/src/fmt/fmt_subscriber.rs +++ b/tracing-subscriber/src/fmt/fmt_subscriber.rs @@ -11,7 +11,7 @@ use std::{ }; use tracing_core::{ field, - span::{Attributes, Id, Record}, + span::{Attributes, Current, Id, Record}, Collect, Event, Metadata, }; @@ -808,6 +808,11 @@ where self.ctx.scope() } + /// Returns the current span for this formatter. + pub fn current_span(&self) -> Current { + self.ctx.current_span() + } + /// Returns the [field formatter] configured by the subscriber invoking /// `format_event`. ///