[−][src]Module tracing_core::field
Span and Event
key-value data.
Spans and events may be annotated with key-value data, referred to as known
as fields. These fields consist of a mapping from a key (corresponding to
a &str
but represented internally as an array index) to a Value
.
Value
s and Subscriber
s
Subscriber
s consume Value
s as fields attached to spans or Event
s.
The set of field keys on a given span or is defined on its Metadata
.
When a span is created, it provides Attributes
to the Subscriber
's
new_span
method, containing any fields whose values were provided when
the span was created; and may call the Subscriber
's record
method
with additional Record
s if values are added for more of its fields.
Similarly, the Event
type passed to the subscriber's event
method
will contain any fields attached to each event.
tracing
represents values as either one of a set of Rust primitives
(i64
, u64
, bool
, and &str
) or using a fmt::Display
or fmt::Debug
implementation. The record
trait method on the Subscriber
trait
allow Subscriber
implementations to provide type-specific behaviour for
consuming values of each type.
Instances of the Visit
trait are provided by Subscriber
s to record the
values attached to spans and Event
. This trait represents the behavior
used to record values of various types. For example, we might record
integers by incrementing counters for their field names, rather than printing
them.
Structs
DebugValue | A |
DisplayValue | A |
Empty | An empty field. |
Field | An opaque key allowing O(1) access to a field in a |
FieldSet | Describes the fields present on a span. |
Iter | An iterator over a set of fields. |
ValueSet | A set of fields and values for a span. |
Traits
Value | A field value of an erased type. |
Visit | Visits typed values. |
Functions
debug | Wraps a type implementing |
display | Wraps a type implementing |