Skip to content

Commit 9a48bad

Browse files
authored
subscriber: Add a public current_span() method for FmtContext (#1290)
1 parent 605434e commit 9a48bad

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tracing-subscriber/src/fmt/fmt_subscriber.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::{
1111
};
1212
use tracing_core::{
1313
field,
14-
span::{Attributes, Id, Record},
14+
span::{Attributes, Current, Id, Record},
1515
Collect, Event, Metadata,
1616
};
1717

@@ -808,6 +808,11 @@ where
808808
self.ctx.scope()
809809
}
810810

811+
/// Returns the current span for this formatter.
812+
pub fn current_span(&self) -> Current {
813+
self.ctx.current_span()
814+
}
815+
811816
/// Returns the [field formatter] configured by the subscriber invoking
812817
/// `format_event`.
813818
///

0 commit comments

Comments
 (0)