<p>An <ahref="event/struct.Event.html"title="struct tracing::event::Event"><code>Event</code></a> represents a <em>moment</em> in time. It signifies something that
happened while a trace was being recorded. <code>Event</code>s are comparable to the log
records emitted by unstructured logging code, but unlike a typical log line,
an <code>Event</code> may occur within the context of a span.</p>
<p>In general, events should be used to represent points in time <em>within</em> a
span — a request returned with a given status code, <em>n</em> new items were
taken from a queue, and so on.</p>
<p>The <ahref="event/struct.Event.html"title="struct tracing::event::Event"><code>Event</code> struct</a> documentation provides further details on using
<p>As <code>Span</code>s and <code>Event</code>s occur, they are recorded or aggregated by
implementations of the <ahref="trait.Subscriber.html"title="trait tracing::Subscriber"><code>Subscriber</code></a> trait. <code>Subscriber</code>s are notified
when an <code>Event</code> takes place and when a <code>Span</code> is entered or exited. These
notifications are represented by the following <code>Subscriber</code> trait methods:</p>
<ul>
<li><ahref="trait.Subscriber.html#tymethod.event"title="method tracing::Subscriber::event"><code>event</code></a>, called when an <code>Event</code> takes place,</li>
<li><ahref="trait.Subscriber.html#tymethod.enter"title="method tracing::Subscriber::enter"><code>enter</code></a>, called when execution enters a <code>Span</code>,</li>
<li><ahref="trait.Subscriber.html#tymethod.exit"title="method tracing::Subscriber::exit"><code>exit</code></a>, called when execution exits a <code>Span</code></li>
</ul>
<p>In addition, subscribers may implement the <ahref="trait.Subscriber.html#tymethod.enabled"title="method tracing::Subscriber::enabled"><code>enabled</code></a> function to <em>filter</em>
the notifications they receive based on <ahref="struct.Metadata.html"title="struct tracing::Metadata">metadata</a> describing each <code>Span</code>
or <code>Event</code>. If a call to <code>Subscriber::enabled</code> returns <code>false</code> for a given
set of metadata, that <code>Subscriber</code> will <em>not</em> be notified about the
corresponding <code>Span</code> or <code>Event</code>. For performance reasons, if no currently
active subscribers express interest in a given set of metadata by returning
<code>true</code>, then the corresponding <code>Span</code> or <code>Event</code> will never be constructed.</p>
<p>The <ahref="macro.span.html"title="macro tracing::span"><code>span!</code></a> macro expands to a <ahref="struct.Span.html"title="struct tracing::Span"><code>Span</code> struct</a> which is used to
record a span. The <ahref="struct.Span.html#method.enter"title="method tracing::Span::enter"><code>Span::enter</code></a> method on that struct records that the
span has been entered, and returns a <ahref="https://github.com/rust-unofficial/patterns/blob/main/src/patterns/behavioural/RAII.md">RAII</a> guard object, which will exit
<spanclass="comment">// Any trace events that occur before the guard is dropped will occur
// within the span.
// Dropping the guard will exit the span.</span></code></pre></div>
<p>The <ahref="https://docs.rs/tracing-attributes/latest/tracing_attributes/attr.instrument.html"><code>#[instrument]</code></a> attribute provides an easy way to
add <code>tracing</code> spans to functions. A function annotated with <code>#[instrument]</code>
will create and enter a span with that function’s name every time the
function is called, with arguments to that function will be recorded as
fields using <code>fmt::Debug</code>.</p>
<p>For example:</p>
<divclass="example-wrap ignore"><ahref="#"class="tooltip"title="This example is not tested">ⓘ</a><preclass="rust rust-example-rendered"><code><spanclass="kw">use </span>tracing::{Level, event, instrument};
<p>For functions which don’t have built-in tracing support and can’t have
the <code>#[instrument]</code> attribute applied (such as from an external crate),
the <ahref="struct.Span.html"title="struct tracing::Span"><code>Span</code> struct</a> has a <ahref="struct.Span.html#method.in_scope"title="method tracing::Span::in_scope"><code>in_scope()</code> method</a>
which can be used to easily wrap synchonous code in a span.</p>
<p><ahref="event/struct.Event.html"title="struct tracing::event::Event"><code>Event</code></a>s are recorded using the <ahref="macro.event.html"title="macro tracing::event"><code>event!</code></a> macro:</p>
<p>The <ahref="macro.span.html"title="macro tracing::span"><code>span!</code></a> and <ahref="macro.event.html"title="macro tracing::event"><code>event!</code></a> macros as well as the <code>#[instrument]</code> attribute
use fairly similar syntax, with some exceptions.</p>
<p>Both macros require a <ahref="struct.Level.html"title="struct tracing::Level"><code>Level</code></a> specifying the verbosity of the span or
event. Optionally, the, <ahref="struct.Metadata.html#method.target"title="method tracing::Metadata::target">target</a> and <ahref="span/struct.Attributes.html#method.parent"title="method tracing::span::Attributes::parent">parent span</a> may be overridden. If the
target and parent span are not overridden, they will default to the
module path where the macro was invoked and the current span (as determined
<p>Structured fields on spans and events are specified using the syntax
<code>field_name = field_value</code>. Fields are separated by commas.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="comment">// records an event with two fields:
// - "answer", with the value 42
// - "question", with the value "life, the universe and everything"
</span><spanclass="macro">event!</span>(Level::INFO, answer = <spanclass="number">42</span>, question = <spanclass="string">"life, the universe, and everything"</span>);</code></pre></div>
<p>As shorthand, local variables may be used as field values without an
assignment, similar to <ahref="https://doc.rust-lang.org/book/ch05-01-defining-structs.html#using-the-field-init-shorthand-when-variables-and-fields-have-the-same-name">struct initializers</a>. For example:</p>
<p>Fields with names that are not Rust identifiers, or with names that are Rust reserved words,
may be created using quoted string literals. However, this may not be used with the local
variable shorthand.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="comment">// records an event with fields whose names are not Rust identifiers
// - "guid:x-request-id", containing a `:`, with the value "abcdef"
// - "type", which is a reserved word, with the value "request"
recorded using its <ahref="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Display.html"title="trait core::fmt::Display"><code>fmt::Display</code></a> implementation:</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="comment">// `my_struct.field` will be recorded using its `fmt::Display` implementation.
<p>The <code>%</code> and <code>?</code> sigils may also be used with local variable shorthand:</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="comment">// `my_struct.field` will be recorded using its `fmt::Display` implementation.
<p>Additionally, a span may declare fields with the special value <ahref="field/struct.Empty.html"title="struct tracing::field::Empty"><code>Empty</code></a>,
which indicates that that the value for that field does not currently exist
<ahref="https://doc.rust-lang.org/1.80.0/alloc/fmt/index.html#usage"title="mod alloc::fmt">format string</a> and (optional) arguments, <strong>after</strong> the event’s
key-value fields. If a format string and arguments are provided,
they will implicitly create a new field named <code>message</code> whose value is the
provided set of format arguments.</p>
<p>For example:</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="kw">let </span>question = <spanclass="string">"the ultimate question of life, the universe, and everything"</span>;
<p><code>tracing</code> also offers a number of macros with preset verbosity levels.
The <ahref="macro.trace.html"title="macro tracing::trace"><code>trace!</code></a>, <ahref="macro.debug.html"title="macro tracing::debug"><code>debug!</code></a>, <ahref="macro.info.html"title="macro tracing::info"><code>info!</code></a>, <ahref="macro.warn.html"title="macro tracing::warn"><code>warn!</code></a>, and <ahref="macro.error.html"title="macro tracing::error"><code>error!</code></a> behave
similarly to the <ahref="macro.event.html"title="macro tracing::event"><code>event!</code></a> macro, but with the <ahref="struct.Level.html"title="struct tracing::Level"><code>Level</code></a> argument already
specified, while the corresponding <ahref="macro.trace_span.html"title="macro tracing::trace_span"><code>trace_span!</code></a>, <ahref="macro.debug_span.html"title="macro tracing::debug_span"><code>debug_span!</code></a>,
<ahref="macro.info_span.html"title="macro tracing::info_span"><code>info_span!</code></a>, <ahref="macro.warn_span.html"title="macro tracing::warn_span"><code>warn_span!</code></a>, and <ahref="macro.error_span.html"title="macro tracing::error_span"><code>error_span!</code></a> macros are the same,
but for the <ahref="macro.span.html"title="macro tracing::span"><code>span!</code></a> macro.</p>
<p>These are intended both as a shorthand, and for compatibility with the <ahref="https://docs.rs/log/0.4.6/log/"><code>log</code></a>
<p>Users of the <ahref="https://docs.rs/log/0.4.6/log/"><code>log</code></a> crate should note that <code>tracing</code> exposes a set of
macros for creating <code>Event</code>s (<code>trace!</code>, <code>debug!</code>, <code>info!</code>, <code>warn!</code>, and
<code>error!</code>) which may be invoked with the same syntax as the similarly-named
macros from the <code>log</code> crate. Often, the process of converting a project to
use <code>tracing</code> can begin with a simple drop-in replacement.</p>
<p>Let’s consider the <code>log</code> crate’s yak-shaving example:</p>
<divclass="example-wrap ignore"><ahref="#"class="tooltip"title="This example is not tested">ⓘ</a><preclass="rust rust-example-rendered"><code><spanclass="kw">use </span>std::{error::Error, io};
<p>In order to record trace events, executables have to use a <code>Subscriber</code>
implementation compatible with <code>tracing</code>. A <code>Subscriber</code> implements a
way of collecting trace data, such as by logging it to standard output.</p>
<p>This library does not contain any <code>Subscriber</code> implementations; these are
provided by <ahref="#related-crates">other crates</a>.</p>
<p>The simplest way to use a subscriber is to call the <ahref="subscriber/fn.set_global_default.html"title="fn tracing::subscriber::set_global_default"><code>set_global_default</code></a>
<strong>Warning</strong>: In general, libraries should <em>not</em> call
<code>set_global_default()</code>! Doing so will cause conflicts when
executables that depend on the library try to set the default later.
</pre>
<p>This subscriber will be used as the default in all threads for the
remainder of the duration of the program, similar to setting the logger
in the <code>log</code> crate.</p>
<p>In addition, the default subscriber can be set through using the
<ahref="subscriber/fn.with_default.html"title="fn tracing::subscriber::with_default"><code>with_default</code></a> function. This follows the <code>tokio</code> pattern of using
closures to represent executing code in a context that is exited at the end
<p>The <ahref="https://docs.rs/log/0.4.6/log/"><code>log</code></a> crate provides a simple, lightweight logging facade for Rust.
While <code>tracing</code> builds upon <code>log</code>’s foundation with richer structured
diagnostic data, <code>log</code>’s simplicity and ubiquity make it the “lowest common
denominator” for text-based logging in Rust — a vast majority of Rust
libraries and applications either emit or consume <code>log</code> records. Therefore,
<code>tracing</code> provides multiple forms of interoperability with <code>log</code>: <code>tracing</code>
instrumentation can emit <code>log</code> records, and a compatibility layer enables
<code>tracing</code><ahref="trait.Subscriber.html"title="trait tracing::Subscriber"><code>Subscriber</code></a>s to consume <code>log</code> records as <code>tracing</code><ahref="event/struct.Event.html"title="struct tracing::event::Event"><code>Event</code></a>s.</p>
<p>This crate provides two feature flags, “log” and “log-always”, which will
cause <ahref="span/index.html"title="mod tracing::span">spans</a> and <ahref="event/struct.Event.html"title="struct tracing::event::Event">events</a> to emit <code>log</code> records. When the “log” feature is
enabled, if no <code>tracing</code><code>Subscriber</code> is active, invoking an event macro or
creating a span with fields will emit a <code>log</code> record. This is intended
primarily for use in libraries which wish to emit diagnostics that can be
consumed by applications using <code>tracing</code><em>or</em><code>log</code>, without paying the
additional overhead of emitting both forms of diagnostics when <code>tracing</code> is
in use.</p>
<p>Enabling the “log-always” feature will cause <code>log</code> records to be emitted
even if a <code>tracing</code><code>Subscriber</code><em>is</em> set. This is intended to be used in
applications where a <code>log</code><code>Logger</code> is being used to record a textual log,
and <code>tracing</code> is used only to record other forms of diagnostics (such as
metrics, profiling, or distributed tracing data). Unlike the “log” feature,
libraries generally should <strong>not</strong> enable the “log-always” feature, as doing
so will prevent applications from being able to opt out of the <code>log</code> records.</p>
<p>See <ahref="#crate-feature-flags">here</a> for more details on this crate’s feature flags.</p>
<p>The generated <code>log</code> records’ messages will be a string representation of the
span or event’s fields, and all additional information recorded by <code>log</code>
(target, verbosity level, module path, file, and line number) will also be
populated. Additionally, <code>log</code> records are also generated when spans are
entered, exited, and closed. Since these additional span lifecycle logs have
the potential to be very verbose, and don’t include additional fields, they
will always be emitted at the <code>Trace</code> level, rather than inheriting the
level of the span that generated them. Furthermore, they are are categorized
under a separate <code>log</code> target, “tracing::span” (and its sub-target,
“tracing::span::active”, for the logs on entering and exiting a span), which
may be enabled or disabled separately from other <code>log</code> records emitted by
<p>The <ahref="https://crates.io/crates/tracing-log"><code>tracing-log</code></a> crate provides a compatibility layer which
allows a <code>tracing</code><ahref="trait.Subscriber.html"title="trait tracing::Subscriber"><code>Subscriber</code></a> to consume <code>log</code> records as though they
were <code>tracing</code><ahref="event/struct.Event.html"title="struct tracing::event::Event">events</a>. This allows applications using <code>tracing</code> to record
the logs emitted by dependencies using <code>log</code> as events within the context of
the application’s trace tree. See <ahref="https://docs.rs/tracing-log/latest/tracing_log/#convert-log-records-to-tracing-events">that crate’s documentation</a>
<p>In addition to <code>tracing</code> and <code>tracing-core</code>, the <ahref="https://github.com/tokio-rs/tracing"><code>tokio-rs/tracing</code></a> repository
contains several additional crates designed to be used with the <code>tracing</code> ecosystem.
This includes a collection of <code>Subscriber</code> implementations, as well as utility
and adapter crates to assist in writing <code>Subscriber</code>s and instrumenting
applications.</p>
<p>In particular, the following crates are likely to be of interest:</p>
<ul>
<li><ahref="https://crates.io/crates/tracing-futures"><code>tracing-futures</code></a> provides a compatibility layer with the <code>futures</code>
crate, allowing spans to be attached to <code>Future</code>s, <code>Stream</code>s, and <code>Executor</code>s.</li>
<li><ahref="https://crates.io/crates/tracing-subscriber"><code>tracing-subscriber</code></a> provides <code>Subscriber</code> implementations and
utilities for working with <code>Subscriber</code>s. This includes a <ahref="https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/struct.Subscriber.html"><code>FmtSubscriber</code></a>
<code>FmtSubscriber</code> for logging formatted trace data to stdout, with similar
filtering and formatting to the <ahref="https://crates.io/crates/env_logger"><code>env_logger</code></a> crate.</li>
<li><ahref="https://crates.io/crates/tracing-log"><code>tracing-log</code></a> provides a compatibility layer with the <ahref="https://docs.rs/log/0.4.6/log/"><code>log</code></a> crate,
allowing log messages to be recorded as <code>tracing</code><code>Event</code>s within the
trace tree. This is useful when a project using <code>tracing</code> have
dependencies which use <code>log</code>. Note that if you’re using
<code>tracing-subscriber</code>’s <code>FmtSubscriber</code>, you don’t need to depend on
<code>tracing-log</code> directly.</li>
<li><ahref="https://crates.io/crates/tracing-appender"><code>tracing-appender</code></a> provides utilities for outputting tracing data,
including a file appender and non blocking writer.</li>
</ul>
<p>Additionally, there are also several third-party crates which are not
maintained by the <code>tokio</code> project. These include:</p>
<ul>
<li><ahref="https://crates.io/crates/tracing-timing"><code>tracing-timing</code></a> implements inter-event timing metrics on top of <code>tracing</code>.
It provides a subscriber that records the time elapsed between pairs of
<code>tracing</code> events and generates histograms.</li>
<li><ahref="https://crates.io/crates/tracing-opentelemetry"><code>tracing-opentelemetry</code></a> provides a subscriber for emitting traces to
<li><ahref="https://crates.io/crates/tracing-honeycomb"><code>tracing-honeycomb</code></a> Provides a layer that reports traces spanning multiple machines to <ahref="https://www.honeycomb.io/">honeycomb.io</a>. Backed by <ahref="https://crates.io/crates/tracing-distributed"><code>tracing-distributed</code></a>.</li>
<li><ahref="https://crates.io/crates/tracing-distributed"><code>tracing-distributed</code></a> Provides a generic implementation of a layer that reports traces spanning multiple machines to some backend.</li>
<li><ahref="https://crates.io/crates/tracing-actix-web"><code>tracing-actix-web</code></a> provides <code>tracing</code> integration for the <code>actix-web</code> web framework.</li>
<li><ahref="https://crates.io/crates/tracing-actix"><code>tracing-actix</code></a> provides <code>tracing</code> integration for the <code>actix</code> actor
framework.</li>
<li><ahref="https://crates.io/crates/axum-insights"><code>axum-insights</code></a> provides <code>tracing</code> integration and Application insights export for the <code>axum</code> web framework.</li>
<li><ahref="https://crates.io/crates/tracing-gelf"><code>tracing-gelf</code></a> implements a subscriber for exporting traces in Greylog
GELF format.</li>
<li><ahref="https://crates.io/crates/tracing-coz"><code>tracing-coz</code></a> provides integration with the <ahref="https://github.com/plasma-umass/coz">coz</a> causal profiler
(Linux-only).</li>
<li><ahref="https://crates.io/crates/tracing-bunyan-formatter"><code>tracing-bunyan-formatter</code></a> provides a layer implementation that reports events and spans
in <ahref="https://github.com/trentm/node-bunyan">bunyan</a> format, enriched with timing information.</li>
<li><ahref="https://docs.rs/tracing-wasm"><code>tracing-wasm</code></a> provides a <code>Subscriber</code>/<code>Layer</code> implementation that reports
events and spans via browser <code>console.log</code> and <ahref="https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API">User Timing API (<code>window.performance</code>)</a>.</li>
<li><ahref="https://docs.rs/tracing-web"><code>tracing-web</code></a> provides a layer implementation of level-aware logging of events
to web browsers’<code>console.*</code> and span events to the <ahref="https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API">User Timing API (<code>window.performance</code>)</a>.</li>
<li><ahref="https://crates.io/crates/tide-tracing"><code>tide-tracing</code></a> provides a <ahref="https://crates.io/crates/tide">tide</a> middleware to trace all incoming requests and responses.</li>
<li><ahref="https://crates.io/crates/test-log"><code>test-log</code></a> takes care of initializing <code>tracing</code> for tests, based on
environment variables with an <code>env_logger</code> compatible syntax.</li>
<li><ahref="https://docs.rs/tracing-unwrap"><code>tracing-unwrap</code></a> provides convenience methods to report failed unwraps
on <code>Result</code> or <code>Option</code> types to a <code>Subscriber</code>.</li>
<li><ahref="https://crates.io/crates/diesel-tracing"><code>diesel-tracing</code></a> provides integration with <ahref="https://crates.io/crates/diesel"><code>diesel</code></a> database connections.</li>
<li><ahref="https://crates.io/crates/tracing-tracy"><code>tracing-tracy</code></a> provides a way to collect <ahref="https://github.com/wolfpld/tracy">Tracy</a> profiles in instrumented
applications.</li>
<li><ahref="https://crates.io/crates/tracing-elastic-apm"><code>tracing-elastic-apm</code></a> provides a layer for reporting traces to <ahref="https://www.elastic.co/apm">Elastic APM</a>.</li>
<li><ahref="https://github.com/microsoft/rust_win_etw/tree/main/win_etw_tracing"><code>tracing-etw</code></a> provides a layer for emitting Windows <ahref="https://docs.microsoft.com/en-us/windows/win32/etw/about-event-tracing">ETW</a> events.</li>
<li><ahref="https://crates.io/crates/tracing-fluent-assertions"><code>tracing-fluent-assertions</code></a> provides a fluent assertions-style testing
framework for validating the behavior of <code>tracing</code> spans.</li>
<li><ahref="https://crates.io/crates/sentry-tracing"><code>sentry-tracing</code></a> provides a layer for reporting events and traces to <ahref="https://sentry.io/welcome/">Sentry</a>.</li>
<li><ahref="https://crates.io/crates/tracing-forest"><code>tracing-forest</code></a> provides a subscriber that preserves contextual coherence by
grouping together logs from the same spans during writing.</li>
<li><ahref="https://crates.io/crates/tracing-loki"><code>tracing-loki</code></a> provides a layer for shipping logs to <ahref="https://grafana.com/oss/loki/">Grafana Loki</a>.</li>
<li><ahref="https://crates.io/crates/tracing-logfmt"><code>tracing-logfmt</code></a> provides a layer that formats events and spans into the logfmt format.</li>
<li><ahref="https://crates.io/crates/reqwest-tracing"><code>reqwest-tracing</code></a> provides a middleware to trace <ahref="https://crates.io/crates/reqwest"><code>reqwest</code></a> HTTP requests.</li>
<li><ahref="https://crates.io/crates/tracing-cloudwatch"><code>tracing-cloudwatch</code></a> provides a layer that sends events to AWS CloudWatch Logs.</li>
<li><ahref="https://crates.io/crates/clippy-tracing"><code>clippy-tracing</code></a> provides a tool to add, remove and check for <code>tracing::instrument</code>.</li>
</ul>
<p>If you’re the maintainer of a <code>tracing</code> ecosystem crate not listed above,
please let us know! We’d love to add your project to the list!</p>
<p>The following crate <ahref="https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section">feature flags</a> are available:</p>
<ul>
<li>
<p>A set of features controlling the <ahref="level_filters/index.html#compile-time-filters"title="mod tracing::level_filters">static verbosity level</a>.</p>
</li>
<li>
<p><code>log</code>: causes trace instrumentation points to emit <ahref="https://docs.rs/log/0.4.6/log/"><code>log</code></a> records as well
as trace events, if a default <code>tracing</code> subscriber has not been set. This
is intended for use in libraries whose users may be using either <code>tracing</code>
or <code>log</code>.</p>
</li>
<li>
<p><code>log-always</code>: Emit <code>log</code> records from all <code>tracing</code> spans and events, even
if a <code>tracing</code> subscriber has been set. This should be set only by
applications which intend to collect traces and logs separately; if an
adapter is used to convert <code>log</code> records into <code>tracing</code> events, this will
cause duplicate events to occur.</p>
</li>
<li>
<p><code>attributes</code>: Includes support for the <code>#[instrument]</code> attribute.
This is on by default, but does bring in the <code>syn</code> crate as a dependency,
which may add to the compile time of crates that do not already use it.</p>
</li>
<li>
<p><code>std</code>: Depend on the Rust standard library (enabled by default).</p>
<p><code>no_std</code> users may disable this feature with <code>default-features = false</code>:</p>
</div></details><h2id="modules"class="section-header">Modules<ahref="#modules"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="mod"href="dispatcher/index.html"title="mod tracing::dispatcher">dispatcher</a></div><divclass="desc docblock-short">Dispatches trace events to <ahref="trait.Subscriber.html"title="trait tracing::Subscriber"><code>Subscriber</code></a>s.</div></li><li><divclass="item-name"><aclass="mod"href="event/index.html"title="mod tracing::event">event</a></div><divclass="desc docblock-short">Events represent single points in time during the execution of a program.</div></li><li><divclass="item-name"><aclass="mod"href="field/index.html"title="mod tracing::field">field</a></div><divclass="desc docblock-short"><code>Span</code> and <code>Event</code> key-value data.</div></li><li><divclass="item-name"><aclass="mod"href="instrument/index.html"title="mod tracing::instrument">instrument</a></div><divclass="desc docblock-short">Attach a span to a <code>std::future::Future</code>.</div></li><li><divclass="item-name"><aclass="mod"href="level_filters/index.html"title="mod tracing::level_filters">level_filters</a></div><divclass="desc docblock-short">Trace verbosity level filtering.</div></li><li><divclass="item-name"><aclass="mod"href="span/index.html"title="mod tracing::span">span</a></div><divclass="desc docblock-short">Spans represent periods of time in which a program was executing in a
particular context.</div></li><li><divclass="item-name"><aclass="mod"href="subscriber/index.html"title="mod tracing::subscriber">subscriber</a></div><divclass="desc docblock-short">Collects and records trace data.</div></li></ul><h2id="macros"class="section-header">Macros<ahref="#macros"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="macro"href="macro.debug.html"title="macro tracing::debug">debug</a></div><divclass="desc docblock-short">Constructs an event at the debug level.</div></li><li><divclass="item-name"><aclass="macro"href="macro.debug_span.html"title="macro tracing::debug_span">debug_span</a></div><divclass="desc docblock-short">Constructs a span at the debug level.</div></li><li><divclass="item-name"><aclass="macro"href="macro.enabled.html"title="macro tracing::enabled">enabled</a></div><divclass="desc docblock-short">Checks whether a span or event is <ahref="trait.Subscriber.html#tymethod.enabled"title="method tracing::Subscriber::enabled">enabled</a> based on the provided <ahref="struct.Metadata.html"title="struct tracing::Metadata">metadata</a>.</div></li><li><divclass="item-name"><aclass="macro"href="macro.error.html"title="macro tracing::error">error</a></div><divclass="desc docblock-short">Constructs an event at the error level.</div></li><li><divclass="item-name"><aclass="macro"href="macro.error_span.html"title="macro tracing::error_span">error_span</a></div><divclass="desc docblock-short">Constructs a span at the error level.</div></li><li><divclass="item-name"><aclass="macro"href="macro.event.html"title="macro tracing::event">event</a></div><divclass="desc docblock-short">Constructs a new <code>Event</code>.</div></li><li><divclass="item-name"><aclass="macro"href="macro.event_enabled.html"title="macro tracing::event_enabled">event_enabled</a></div><divclass="desc docblock-short">Tests whether an event with the specified level and target would be enabled.</div></li><li><divclass="item-name"><aclass="macro"href="macro.info.html"title="macro tracing::info">info</a></div><divclass="desc docblock-short">Constructs an event at the info level.</div></li><li><divclass="item-name"><aclass="macro"href="macro.info_span.html"title="macro tracing::info_span">info_span</a></div><divclass="desc docblock-short">Constructs a span at the info level.</div></li><li><divclass="item-name"><aclass="macro"href="macro.span.html"title="macro tracing::span">span</a></div><divclass="desc docblock-short">Constructs a new span.</div></li><li><divclass="item-name"><aclass="macro"href="macro.span_enabled.html"title="macro tracing::span_enabled">span_enabled</a></div><divclass="desc docblock-short">Tests whether a span with the specified level and target would be enabled.</div></li><li><divclass="item-name"><aclass="macro"href="macro.trace.html"title="macro tracing::trace">trace</a></div><divclass="desc docblock-short">Constructs an event at the trace level.</div></li><li><divclass="item-name"><aclass="macro"href="macro.trace_span.html"title="macro tracing::trace_span">trace_span</a></div><divclass="desc docblock-short">Constructs a span at the trace level.</div></li><li><divclass="item-name"><aclass="macro"href="macro.warn.html"title="macro tracing::warn">warn</a></div><divclass="desc docblock-short">Constructs an event at the warn level.</div></li><li><divclass="item-name"><aclass="macro"href="macro.warn_span.html"title="macro tracing::warn_span">warn_span</a></div><divclass="desc docblock-short">Constructs a span at the warn level.</div></li></ul><h2id="structs"class="section-header">Structs<ahref="#structs"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="struct"href="struct.Dispatch.html"title="struct tracing::Dispatch">Dispatch</a></div><divclass="desc docblock-short"><code>Dispatch</code> trace data to a <ahref="trait.Subscriber.html"title="trait tracing::Subscriber"><code>Subscriber</code></a>.</div></li><li><divclass="item-name"><aclass="struct"href="struc
execution of a program.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Level.html"title="struct tracing::Level">Level</a></div><divclass="desc docblock-short">Describes the level of verbosity of a span or event.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Metadata.html"title="struct tracing::Metadata">Metadata</a></div><divclass="desc docblock-short">Metadata describing a <ahref="../tracing_core/span/index.html"title="mod tracing_core::span">span</a> or <ahref="event/index.html"title="mod tracing::event">event</a>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Span.html"title="struct tracing::Span">Span</a></div><divclass="desc docblock-short">A handle representing a span, with the capability to enter the span if it
exists.</div></li></ul><h2id="traits"class="section-header">Traits<ahref="#traits"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="trait"href="trait.Instrument.html"title="trait tracing::Instrument">Instrument</a></div><divclass="desc docblock-short">Attaches spans to a <ahref="https://doc.rust-lang.org/1.80.0/core/future/future/trait.Future.html"title="trait core::future::future::Future"><code>std::future::Future</code></a>.</div></li><li><divclass="item-name"><aclass="trait"href="trait.Subscriber.html"title="trait tracing::Subscriber">Subscriber</a></div><divclass="desc docblock-short">Trait representing the functions required to collect trace data.</div></li><li><divclass="item-name"><aclass="trait"href="trait.Value.html"title="trait tracing::Value">Value</a></div><divclass="desc docblock-short">A field value of an erased type.</div></li></ul><h2id="attributes"class="section-header">Attribute Macros<ahref="#attributes"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="attr"href="attr.instrument.html"title="attr tracing::instrument">instrument</a></div><divclass="desc docblock-short">Instruments a function to create and enter a <code>tracing</code><ahref="https://docs.rs/tracing/latest/tracing/span/index.html">span</a> every time