Struct tracing_subscriber::fmt::FmtContext [−][src]
pub struct FmtContext<'a, S, N> { /* fields omitted */ }
fmt
and std
only.Expand description
Provides the current span context to a formatter.
Implementations
impl<'a, S, N> FmtContext<'a, S, N> where
S: Subscriber + for<'lookup> LookupSpan<'lookup>,
N: for<'writer> FormatFields<'writer> + 'static,
impl<'a, S, N> FmtContext<'a, S, N> where
S: Subscriber + for<'lookup> LookupSpan<'lookup>,
N: for<'writer> FormatFields<'writer> + 'static,
Visits every span in the current context with a closure.
The provided closure will be called first with the current span, and then with that span’s parent, and then that span’s parent, and so on until a root span is reached.
Returns metadata for the span with the given id
, if it exists.
If this returns None
, then no span exists for that ID (either it has
closed or the ID is invalid).
Returns stored data for the span with the given id
, if it exists.
If this returns None
, then no span exists for that ID (either it has
closed or the ID is invalid).
Returns true
if an active span exists for the given Id
.
pub fn lookup_current(&self) -> Option<SpanRef<'_, S>>ⓘNotable traits for Option<L>impl<L, S> Layer<S> for Option<L> where
L: Layer<S>,
S: Subscriber,
where
S: for<'lookup> LookupSpan<'lookup>,
pub fn lookup_current(&self) -> Option<SpanRef<'_, S>>ⓘNotable traits for Option<L>impl<L, S> Layer<S> for Option<L> where
L: Layer<S>,
S: Subscriber,
where
S: for<'lookup> LookupSpan<'lookup>,
impl<L, S> Layer<S> for Option<L> where
L: Layer<S>,
S: Subscriber,
Returns stored data for the span that the wrapped subscriber considers to be the current.
If this returns None
, then we are not currently within a span.
Returns the current span for this formatter.
Returns the field formatter configured by the subscriber invoking
format_event
.
The event formatter may use the returned field formatter to format the fields of any events it records.
Trait Implementations
impl<'cx, 'writer, S, N> FormatFields<'writer> for FmtContext<'cx, S, N> where
S: Subscriber + for<'lookup> LookupSpan<'lookup>,
N: FormatFields<'writer> + 'static,
impl<'cx, 'writer, S, N> FormatFields<'writer> for FmtContext<'cx, S, N> where
S: Subscriber + for<'lookup> LookupSpan<'lookup>,
N: FormatFields<'writer> + 'static,
Format the provided fields
to the provided Writer
, returning a result.
fn add_fields(
&self,
current: &'writer mut FormattedFields<Self>,
fields: &Record<'_>
) -> Result
fn add_fields(
&self,
current: &'writer mut FormattedFields<Self>,
fields: &Record<'_>
) -> Result
Record additional field(s) on an existing span. Read more
Auto Trait Implementations
impl<'a, S, N> RefUnwindSafe for FmtContext<'a, S, N> where
N: RefUnwindSafe,
S: RefUnwindSafe,
impl<'a, S, N> Send for FmtContext<'a, S, N> where
N: Sync,
S: Sync,
impl<'a, S, N> Sync for FmtContext<'a, S, N> where
N: Sync,
S: Sync,
impl<'a, S, N> Unpin for FmtContext<'a, S, N>
impl<'a, S, N> UnwindSafe for FmtContext<'a, S, N> where
N: RefUnwindSafe,
S: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more