logo
pub struct FmtContext<'a, S, N> { /* private fields */ }
Available on crate features fmt and std only.
Expand description

Provides the current span context to a formatter.

Implementations

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.

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 stored data for the parent span of the event currently being formatted.

If the event has a contextual parent, this will return the current span. If the event has an explicit parent span, this will return that span. If the event does not have a parent span, this will return None.

Returns an iterator over the stored data for all the spans in the current context, starting with the specified span and ending with the root of the trace tree and ending with the current span.

This is equivalent to the Context::span_scope method.

Note
Note: Compared to scope this
returns the spans in reverse order (from leaf to root). Use
Scope::from_root
in case root-to-leaf ordering is desired.
Note: This requires the wrapped subscriber to implement the
LookupSpan trait.
See the documentation on Context's
declaration for details.

Returns an iterator over the stored data for all the spans in the event’s span context, starting with its parent span and ending with the root of the trace tree.

This is equivalent to calling the Context::event_scope method and passing the event currently being formatted.

Note: Compared to scope this
returns the spans in reverse order (from leaf to root). Use
Scope::from_root
in case root-to-leaf ordering is desired.
Note: This requires the wrapped subscriber to implement the
LookupSpan trait.
See the documentation on Context's
declaration for details.

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

Formats the value using the given formatter. Read more

Format the provided fields to the provided Writer, returning a result.

Record additional field(s) on an existing span. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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