<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="Core primitives for `tracing`."><title>tracing_core - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><linkrel="stylesheet"href="../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../static.files/rustdoc-5bc39a1768837dd0.css"><metaname="rustdoc-vars"data-root-path="../"data-static-root-path="../static.files/"data-current-crate="tracing_core"data-themes=""data-resource-suffix=""data-rustdoc-version="1.77.0 (aedd173a2 2024-03-17)"data-channel="1.77.0"data-search-js="search-dd67cee4cfa65049.js"data-settings-js="settings-4313503d2e1961c2.js"><scriptsrc="../static.files/storage-4c98445ec4002617.js"></script><scriptdefersrc="../crates.js"></script><scriptdefersrc="../static.files/main-48f368f3872407c8.js"></script><noscript><linkrel="stylesheet"href="../static.files/noscript-04d5337699b92874.css"></noscript><linkrel="alternate icon"type="image/png"href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><linkrel="alternate icon"type="image/png"href="../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle"title="show sidebar"></button><aclass="logo-container"href="../tracing_core/index.html"><imgsrc="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png"alt=""></a></nav><navclass="sidebar"><divclass="sidebar-crate"><aclass="logo-container"href="../tracing_core/index.html"><imgsrc="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png"alt="logo"></a><h2><ahref="../tracing_core/index.html">tracing_core</a><spanclass="version">0.1.32</span></h2></div><divclass="sidebar-elems"><ulclass="block">
<main><divclass="width-limiter"><navclass="sub"><formclass="search-form"><span></span><divid="sidebar-button"tabindex="-1"><ahref="../tracing_core/all.html"title="show sidebar"></a></div><inputclass="search-input"name="search"aria-label="Run search in the documentation"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"><divid="help-button"tabindex="-1"><ahref="../help.html"title="help">?</a></div><divid="settings-menu"tabindex="-1"><ahref="../settings.html"title="settings"><imgwidth="22"height="22"alt="Change settings"src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><sectionid="main-content"class="content"><divclass="main-heading"><h1>Crate <aclass="mod"href="#">tracing_core</a><buttonid="copy-path"title="Copy item path to clipboard"><imgsrc="../static.files/clipboard-7571035ce49a181d.svg"width="19"height="18"alt="Copy item path"></button></h1><spanclass="out-of-band"><aclass="src"href="../src/tracing_core/lib.rs.html#1-293">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>Core primitives for <code>tracing</code>.</p>
<p><ahref="https://crates.io/crates/tracing"><code>tracing</code></a> is a framework for instrumenting Rust programs to collect
structured, event-based diagnostic information. This crate defines the core
primitives of <code>tracing</code>.</p>
<p>This crate provides:</p>
<ul>
<li>
<p><ahref="span/struct.Id.html"title="struct tracing_core::span::Id"><code>span::Id</code></a> identifies a span within the execution of a program.</p>
</li>
<li>
<p><ahref="struct.Event.html"title="struct tracing_core::Event"><code>Event</code></a> represents a single event within a trace.</p>
</li>
<li>
<p><ahref="trait.Subscriber.html"title="trait tracing_core::Subscriber"><code>Subscriber</code></a>, the trait implemented to collect trace data.</p>
</li>
<li>
<p><ahref="struct.Metadata.html"title="struct tracing_core::Metadata"><code>Metadata</code></a> and <ahref="trait.Callsite.html"title="trait tracing_core::Callsite"><code>Callsite</code></a> provide information describing spans and
<code>Event</code>s.</p>
</li>
<li>
<p><ahref="struct.Field.html"title="struct tracing_core::Field"><code>Field</code></a>, <ahref="field/struct.FieldSet.html"title="struct tracing_core::field::FieldSet"><code>FieldSet</code></a>, <ahref="field/trait.Value.html"title="trait tracing_core::field::Value"><code>Value</code></a>, and <ahref="field/struct.ValueSet.html"title="struct tracing_core::field::ValueSet"><code>ValueSet</code></a> represent the
structured data attached to a span.</p>
</li>
<li>
<p><ahref="struct.Dispatch.html"title="struct tracing_core::Dispatch"><code>Dispatch</code></a> allows spans and events to be dispatched to <code>Subscriber</code>s.</p>
</li>
</ul>
<p>In addition, it defines the global callsite registry and per-thread current
dispatcher which other components of the tracing system rely on.</p>
</div></details><h2id="reexports"class="section-header">Re-exports<ahref="#reexports"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"id="reexport.Kind"><code>pub use self::metadata::<aclass="struct"href="metadata/struct.Kind.html"title="struct tracing_core::metadata::Kind">Kind</a>;</code></div></li><li><divclass="item-name"id="reexport.Interest"><code>pub use self::subscriber::<aclass="struct"href="subscriber/struct.Interest.html"title="struct tracing_core::subscriber::Interest">Interest</a>;</code></div></li></ul><h2id="modules"class="section-header">Modules<ahref="#modules"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="mod"href="callsite/index.html"title="mod tracing_core::callsite">callsite</a></div><divclass="desc docblock-short">Callsites represent the source locations from which spans or events
originate.</div></li><li><divclass="item-name"><aclass="mod"href="dispatcher/index.html"title="mod tracing_core::dispatcher">dispatcher</a></div><divclass="desc docblock-short">Dispatches trace events to <ahref="trait.Subscriber.html"title="trait tracing_core::Subscriber"><code>Subscriber</code></a>s.</div></li><li><divclass="item-name"><aclass="mod"href="event/index.html"title="mod tracing_core::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_core::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="metadata/index.html"title="mod tracing_core::metadata">metadata</a></div><divclass="desc docblock-short">Metadata describing trace data.</div></li><li><divclass="item-name"><aclass="mod"href="span/index.html"title="mod tracing_core::span">span</a></div><divclass="desc docblock-short">Spans represent periods of time in the execution of a program.</div></li><li><divclass="item-name"><aclass="mod"href="subscriber/index.html"title="mod tracing_core::subscriber">subscriber</a></div><divclass="desc docblock-short">Collectors collect and record 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.identify_callsite.html"title="macro tracing_core::identify_callsite">identify_callsite</a></div><divclass="desc docblock-short">Statically constructs an <ahref="callsite/struct.Identifier.html"title="struct tracing_core::callsite::Identifier"><code>Identifier</code></a> for the provided <ahref="trait.Callsite.html"title="trait tracing_core::Callsite"><code>Callsite</code></a>.</div></li><li><divclass="item-name"><aclass="macro"href="macro.metadata.html"title="macro tracing_core::metadata">metadata</a></div><divclass="desc docblock-short">Statically constructs new span <ahref="struct.Metadata.html"title="struct tracing_core::Metadata">metadata</a>.</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_core::Dispatch">Dispatch</a></div><divclass="desc docblock-short"><code>Dispatch</code> trace data to a <ahref="trait.Subscriber.html"title="trait tracing_core::Subscriber"><code>Subscriber</code></a>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Event.html"title="struct tracing_core::Event">Event</a></div><divclass="desc docblock-short"><code>Event</code>s represent single points in time where something occurred during the
execution of a program.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Field.html"title="struct tracing_core::Field">Field</a></div><divclass="desc docblock-short">An opaque key allowing <em>O</em>(1) access to a field in a <code>Span</code>’s key-value
data.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Level.html"title="struct tracing_core::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.LevelFilter.html"title="struct tracing_core::LevelFilter">LevelFilter</a></div><divclass="desc docblock-short">A filter comparable to a verbosity <ahref="struct.Level.html"title="struct tracing_core::Level"><code>Level</code></a>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Metadata.html"title="struct tracing_core::Metadata">Metadata</a></div><divclass="desc docblock-short">Metadata describing a <ahref="span/index.html"title="mod tracing_core::span">span</a> or <ahref="event/index.html"title="mod tracing_core::event">event</a>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Once.html"title="struct tracing_core::Once">Once</a></div><divclass="desc docblock-short">A synchronization primitive which can be used to run a one-time global
initialization. Useful for one-time initialization for FFI or related
functionality. This type can only be constructed with <ahref="struct.Once.html#method.new"title="associated function tracing_core::Once::new"><code>Once::new()</code></a>.</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.Callsite.html"title="trait tracing_core::Callsite">Callsite</a></div><divclass="desc docblock-short">Trait implemented by callsites.</div></li><li><divclass="item-name"><aclass="trait"href="trait.Subscriber.html"title="trait tracing_core::Subscriber">Subscriber</a></div><divclass="desc docblock-short">Trait representing the functions required to collect trace data.</div></li></ul></section></div></main></body></html>