310 lines
63 KiB
HTML
310 lines
63 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Trait representing the functions required to collect trace data."><meta name="keywords" content="rust, rustlang, rust-lang, Subscriber"><title>Subscriber in tracing::subscriber - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script src="../../crates.js"></script><script defer src="../../main.js"></script>
|
||
<noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a class="sidebar-logo" href="../../tracing/index.html"><div class="logo-container"><img src="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png" alt="logo"></div>
|
||
</a><h2 class="location">Trait Subscriber</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#required-methods">Required Methods</a></h3><div class="sidebar-links"><a href="#tymethod.enabled">enabled</a><a href="#tymethod.enter">enter</a><a href="#tymethod.event">event</a><a href="#tymethod.exit">exit</a><a href="#tymethod.new_span">new_span</a><a href="#tymethod.record">record</a><a href="#tymethod.record_follows_from">record_follows_from</a></div><h3 class="sidebar-title"><a href="#provided-methods">Provided Methods</a></h3><div class="sidebar-links"><a href="#method.clone_span">clone_span</a><a href="#method.current_span">current_span</a><a href="#method.downcast_raw">downcast_raw</a><a href="#method.drop_span">drop_span</a><a href="#method.max_level_hint">max_level_hint</a><a href="#method.register_callsite">register_callsite</a><a href="#method.try_close">try_close</a></div><h3 class="sidebar-title"><a href="#foreign-impls">Implementations on Foreign Types</a></h3><div class="sidebar-links"><a href="#impl-Subscriber-for-Arc%3Cdyn%20Subscriber%20+%20Sync%20+%20Send%20+%20%27static%3E">Arc<dyn Subscriber + Sync + Send + 'static></a><a href="#impl-Subscriber-for-Box%3Cdyn%20Subscriber%20+%20Sync%20+%20Send%20+%20%27static%2C%20Global%3E">Box<dyn Subscriber + Sync + Send + 'static, Global></a></div><h3 class="sidebar-title"><a href="#implementations">Methods</a></h3><div class="sidebar-links"><a href="#method.downcast_ref">downcast_ref</a><a href="#method.is">is</a></div><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div><h2 class="location">Other items in<br><a href="../index.html">tracing</a>::<wbr><a href="index.html">subscriber</a></h2><div id="sidebar-vars" data-name="Subscriber" data-ty="trait" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../tracing/index.html"><img src="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png" alt="logo"></a><nav class="sub"><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../wheel.svg"></a></div></form></nav></div><section id="main-content" class="content"><h1 class="fqn"><span class="in-band">Trait <a href="../index.html">tracing</a>::<wbr><a href="index.html">subscriber</a>::<wbr><a class="trait" href="#">Subscriber</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#74-458" title="goto source code">[src]</a></span></h1><div class="docblock item-decl"><pre class="rust trait"><code>pub trait Subscriber: 'static {
|
||
<details class="rustdoc-toggle type-contents-toggle"><summary class="hideme"><span>Show 14 methods</span></summary> fn <a href="#tymethod.enabled" class="fnname">enabled</a>(&self, metadata: &<a class="struct" href="../struct.Metadata.html" title="struct tracing::Metadata">Metadata</a><'_>) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>;
|
||
<div class="item-spacer"></div> fn <a href="#tymethod.new_span" class="fnname">new_span</a>(&self, span: &<a class="struct" href="../span/struct.Attributes.html" title="struct tracing::span::Attributes">Attributes</a><'_>) -> <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>;
|
||
<div class="item-spacer"></div> fn <a href="#tymethod.record" class="fnname">record</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>, values: &<a class="struct" href="../span/struct.Record.html" title="struct tracing::span::Record">Record</a><'_>);
|
||
<div class="item-spacer"></div> fn <a href="#tymethod.record_follows_from" class="fnname">record_follows_from</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>, follows: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>);
|
||
<div class="item-spacer"></div> fn <a href="#tymethod.event" class="fnname">event</a>(&self, event: &<a class="struct" href="../event/struct.Event.html" title="struct tracing::event::Event">Event</a><'_>);
|
||
<div class="item-spacer"></div> fn <a href="#tymethod.enter" class="fnname">enter</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>);
|
||
<div class="item-spacer"></div> fn <a href="#tymethod.exit" class="fnname">exit</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>);
|
||
|
||
fn <a href="#method.register_callsite" class="fnname">register_callsite</a>(<br> &self, <br> metadata: &'static <a class="struct" href="../struct.Metadata.html" title="struct tracing::Metadata">Metadata</a><'static><br> ) -> <a class="struct" href="struct.Interest.html" title="struct tracing::subscriber::Interest">Interest</a> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.max_level_hint" class="fnname">max_level_hint</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../level_filters/struct.LevelFilter.html" title="struct tracing::level_filters::LevelFilter">LevelFilter</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.clone_span" class="fnname">clone_span</a>(&self, id: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>) -> <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.drop_span" class="fnname">drop_span</a>(&self, _id: <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>) { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.try_close" class="fnname">try_close</a>(&self, id: <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.current_span" class="fnname">current_span</a>(&self) -> <a class="struct" href="../../tracing_core/span/struct.Current.html" title="struct tracing_core::span::Current">Current</a> { ... }
|
||
<div class="item-spacer"></div> unsafe fn <a href="#method.downcast_raw" class="fnname">downcast_raw</a>(&self, id: <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.pointer.html">*const </a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>> { ... }
|
||
</details>}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait representing the functions required to collect trace data.</p>
|
||
<p>Crates that provide implementations of methods for collecting or recording
|
||
trace data should implement the <code>Subscriber</code> interface. This trait is
|
||
intended to represent fundamental primitives for collecting trace events and
|
||
spans — other libraries may offer utility functions and types to make
|
||
subscriber implementations more modular or improve the ergonomics of writing
|
||
subscribers.</p>
|
||
<p>A subscriber is responsible for the following:</p>
|
||
<ul>
|
||
<li>Registering new spans as they are created, and providing them with span
|
||
IDs. Implicitly, this means the subscriber may determine the strategy for
|
||
determining span equality.</li>
|
||
<li>Recording the attachment of field values and follows-from annotations to
|
||
spans.</li>
|
||
<li>Filtering spans and events, and determining when those filters must be
|
||
invalidated.</li>
|
||
<li>Observing spans as they are entered, exited, and closed, and events as
|
||
they occur.</li>
|
||
</ul>
|
||
<p>When a span is entered or exited, the subscriber is provided only with the
|
||
<a href="../span/struct.Id.html">ID</a> with which it tagged that span when it was created. This means
|
||
that it is up to the subscriber to determine whether and how span <em>data</em> —
|
||
the fields and metadata describing the span — should be stored. The
|
||
<a href="trait.Subscriber.html#method.new_span"><code>new_span</code></a> function is called when a new span is created, and at that
|
||
point, the subscriber <em>may</em> choose to store the associated data if it will
|
||
be referenced again. However, if the data has already been recorded and will
|
||
not be needed by the implementations of <code>enter</code> and <code>exit</code>, the subscriber
|
||
may freely discard that data without allocating space to store it.</p>
|
||
<h3 id="overriding-default-impls" class="section-header"><a href="#overriding-default-impls">Overriding default impls</a></h3>
|
||
<p>Some trait methods on <code>Subscriber</code> have default implementations, either in
|
||
order to reduce the surface area of implementing <code>Subscriber</code>, or for
|
||
backward-compatibility reasons. However, many subscribers will likely want
|
||
to override these default implementations.</p>
|
||
<p>The following methods are likely of interest:</p>
|
||
<ul>
|
||
<li><a href="trait.Subscriber.html#method.register_callsite"><code>register_callsite</code></a> is called once for each callsite from which a span
|
||
event may originate, and returns an <a href="struct.Interest.html"><code>Interest</code></a> value describing whether or
|
||
not the subscriber wishes to see events or spans from that callsite. By
|
||
default, it calls <a href="trait.Subscriber.html#method.enabled"><code>enabled</code></a>, and returns <code>Interest::always()</code> if
|
||
<code>enabled</code> returns true, or <code>Interest::never()</code> if enabled returns false.
|
||
However, if the subscriber’s interest can change dynamically at runtime,
|
||
it may want to override this function to return <code>Interest::sometimes()</code>.
|
||
Additionally, subscribers which wish to perform a behaviour once for each
|
||
callsite, such as allocating storage for data related to that callsite,
|
||
can perform it in <code>register_callsite</code>.</li>
|
||
<li><a href="trait.Subscriber.html#method.clone_span"><code>clone_span</code></a> is called every time a span ID is cloned, and <a href="trait.Subscriber.html#method.try_close"><code>try_close</code></a>
|
||
is called when a span ID is dropped. By default, these functions do
|
||
nothing. However, they can be used to implement reference counting for
|
||
spans, allowing subscribers to free storage for span data and to determine
|
||
when a span has <em>closed</em> permanently (rather than being exited).
|
||
Subscribers which store per-span data or which need to track span closures
|
||
should override these functions together.</li>
|
||
</ul>
|
||
</div></details><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.enabled" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#172" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.enabled" class="fnname">enabled</a>(&self, metadata: &<a class="struct" href="../struct.Metadata.html" title="struct tracing::Metadata">Metadata</a><'_>) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a></h4></div></summary><div class="docblock"><p>Returns true if a span or event with the specified <a href="../metadata/struct.Metadata.html">metadata</a> would be
|
||
recorded.</p>
|
||
<p>By default, it is assumed that this filter needs only be evaluated once
|
||
for each callsite, so it is called by <a href="#method.register_callsite"><code>register_callsite</code></a> when each
|
||
callsite is registered. The result is used to determine if the subscriber
|
||
is always <a href="struct.Interest.html">interested</a> or never interested in that callsite. This is intended
|
||
primarily as an optimization, so that expensive filters (such as those
|
||
involving string search, et cetera) need not be re-evaluated.</p>
|
||
<p>However, if the subscriber’s interest in a particular span or event may
|
||
change, or depends on contexts only determined dynamically at runtime,
|
||
then the <code>register_callsite</code> method should be overridden to return
|
||
<a href="struct.Interest.html#method.sometimes"><code>Interest::sometimes</code></a>. In that case, this function will be called every
|
||
time that span or event occurs.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.new_span" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#225" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.new_span" class="fnname">new_span</a>(&self, span: &<a class="struct" href="../span/struct.Attributes.html" title="struct tracing::span::Attributes">Attributes</a><'_>) -> <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a></h4></div></summary><div class="docblock"><p>Visit the construction of a new span, returning a new <a href="../span/struct.Id.html">span ID</a> for the
|
||
span being constructed.</p>
|
||
<p>The provided <a href="../span/struct.Attributes.html"><code>Attributes</code></a> contains any field values that were provided
|
||
when the span was created. The subscriber may pass a <a href="../field/trait.Visit.html">visitor</a> to the
|
||
<code>Attributes</code>’ <a href="../span/struct.Attributes.html#method.record"><code>record</code> method</a> to record these values.</p>
|
||
<p>IDs are used to uniquely identify spans and events within the context of a
|
||
subscriber, so span equality will be based on the returned ID. Thus, if
|
||
the subscriber wishes for all spans with the same metadata to be
|
||
considered equal, it should return the same ID every time it is given a
|
||
particular set of metadata. Similarly, if it wishes for two separate
|
||
instances of a span with the same metadata to <em>not</em> be equal, it should
|
||
return a distinct ID every time this function is called, regardless of
|
||
the metadata.</p>
|
||
<p>Note that the subscriber is free to assign span IDs based on whatever
|
||
scheme it sees fit. Any guarantees about uniqueness, ordering, or ID
|
||
reuse are left up to the subscriber implementation to determine.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.record" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#265" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.record" class="fnname">record</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>, values: &<a class="struct" href="../span/struct.Record.html" title="struct tracing::span::Record">Record</a><'_>)</h4></div></summary><div class="docblock"><p>Record a set of values on a span.</p>
|
||
<p>This method will be invoked when value is recorded on a span.
|
||
Recording multiple values for the same field is possible,
|
||
but the actual behaviour is defined by the subscriber implementation.</p>
|
||
<p>Keep in mind that a span might not provide a value
|
||
for each field it declares.</p>
|
||
<p>The subscriber is expected to provide a <a href="../field/trait.Visit.html">visitor</a> to the <code>Record</code>’s
|
||
<a href="../span/struct.Record.html#method.record"><code>record</code> method</a> in order to record the added values.</p>
|
||
<h5 id="example" class="section-header"><a href="#example">Example</a></h5>
|
||
<p>“foo = 3” will be recorded when <a href="../span/struct.Attributes.html#method.record"><code>record</code></a> is called on the
|
||
<code>Attributes</code> passed to <code>new_span</code>.
|
||
Since values are not provided for the <code>bar</code> and <code>baz</code> fields,
|
||
the span’s <code>Metadata</code> will indicate that it <em>has</em> those fields,
|
||
but values for them won’t be recorded at this time.</p>
|
||
|
||
<div class='information'><div class='tooltip ignore'>ⓘ</div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore"><code>
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">span!</span>(<span class="string">"my_span"</span>, <span class="ident">foo</span> <span class="op">=</span> <span class="number">3</span>, <span class="ident">bar</span>, <span class="ident">baz</span>);
|
||
|
||
<span class="comment">// `Subscriber::record` will be called with a `Record`</span>
|
||
<span class="comment">// containing "bar = false"</span>
|
||
<span class="ident">span</span>.<span class="ident">record</span>(<span class="string">"bar"</span>, <span class="kw-2">&</span><span class="bool-val">false</span>);
|
||
|
||
<span class="comment">// `Subscriber::record` will be called with a `Record`</span>
|
||
<span class="comment">// containing "baz = "a string""</span>
|
||
<span class="ident">span</span>.<span class="ident">record</span>(<span class="string">"baz"</span>, <span class="kw-2">&</span><span class="string">"a string"</span>);</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.record_follows_from" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#285" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.record_follows_from" class="fnname">record_follows_from</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>, follows: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div></summary><div class="docblock"><p>Adds an indication that <code>span</code> follows from the span with the id
|
||
<code>follows</code>.</p>
|
||
<p>This relationship differs somewhat from the parent-child relationship: a
|
||
span may have any number of prior spans, rather than a single one; and
|
||
spans are not considered to be executing <em>inside</em> of the spans they
|
||
follow from. This means that a span may close even if subsequent spans
|
||
that follow from it are still open, and time spent inside of a
|
||
subsequent span should not be included in the time its precedents were
|
||
executing. This is used to model causal relationships such as when a
|
||
single future spawns several related background tasks, et cetera.</p>
|
||
<p>If the subscriber has spans corresponding to the given IDs, it should
|
||
record this relationship in whatever way it deems necessary. Otherwise,
|
||
if one or both of the given span IDs do not correspond to spans that the
|
||
subscriber knows about, or if a cyclical relationship would be created
|
||
(i.e., some span <em>a</em> which proceeds some other span <em>b</em> may not also
|
||
follow from <em>b</em>), it may silently do nothing.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.event" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#305" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.event" class="fnname">event</a>(&self, event: &<a class="struct" href="../event/struct.Event.html" title="struct tracing::event::Event">Event</a><'_>)</h4></div></summary><div class="docblock"><p>Records that an <a href="../event/struct.Event.html"><code>Event</code></a> has occurred.</p>
|
||
<p>This method will be invoked when an Event is constructed by
|
||
the <code>Event</code>’s <a href="../event/struct.Event.html#method.dispatch"><code>dispatch</code> method</a>. For example, this happens internally
|
||
when an event macro from <code>tracing</code> is called.</p>
|
||
<p>The key difference between this method and <code>record</code> is that <code>record</code> is
|
||
called when a value is recorded for a field defined by a span,
|
||
while <code>event</code> is called when a new event occurs.</p>
|
||
<p>The provided <code>Event</code> struct contains any field values attached to the
|
||
event. The subscriber may pass a <a href="../field/trait.Visit.html">visitor</a> to the <code>Event</code>’s
|
||
<a href="../event/struct.Event.html#method.record"><code>record</code> method</a> to record these values.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.enter" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#315" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.enter" class="fnname">enter</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div></summary><div class="docblock"><p>Records that a span has been entered.</p>
|
||
<p>When entering a span, this method is called to notify the subscriber
|
||
that the span has been entered. The subscriber is provided with the
|
||
<a href="../span/struct.Id.html">span ID</a> of the entered span, and should update any internal state
|
||
tracking the current span accordingly.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.exit" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#327" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.exit" class="fnname">exit</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div></summary><div class="docblock"><p>Records that a span has been exited.</p>
|
||
<p>When exiting a span, this method is called to notify the subscriber
|
||
that the span has been exited. The subscriber is provided with the
|
||
<a href="../span/struct.Id.html">span ID</a> of the exited span, and should update any internal state
|
||
tracking the current span accordingly.</p>
|
||
<p>Exiting a span does not imply that the span will not be re-entered.</p>
|
||
</div></details></div><h2 id="provided-methods" class="small-section-header">Provided methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="method.register_callsite" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#144" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.register_callsite" class="fnname">register_callsite</a>(&self, metadata: &'static <a class="struct" href="../struct.Metadata.html" title="struct tracing::Metadata">Metadata</a><'static>) -> <a class="struct" href="struct.Interest.html" title="struct tracing::subscriber::Interest">Interest</a></h4></div></summary><div class="docblock"><p>Registers a new callsite with this subscriber, returning whether or not
|
||
the subscriber is interested in being notified about the callsite.</p>
|
||
<p>By default, this function assumes that the subscriber’s <a href="#method.enabled">filter</a>
|
||
represents an unchanging view of its interest in the callsite. However,
|
||
if this is not the case, subscribers may override this function to
|
||
indicate different interests, or to implement behaviour that should run
|
||
once for every callsite.</p>
|
||
<p>This function is guaranteed to be called at least once per callsite on
|
||
every active subscriber. The subscriber may store the keys to fields it
|
||
cares about in order to reduce the cost of accessing fields by name,
|
||
preallocate storage for that callsite, or perform any other actions it
|
||
wishes to perform once for each callsite.</p>
|
||
<p>The subscriber should then return an <a href="struct.Interest.html"><code>Interest</code></a>, indicating
|
||
whether it is interested in being notified about that callsite in the
|
||
future. This may be <code>Always</code> indicating that the subscriber always
|
||
wishes to be notified about the callsite, and its filter need not be
|
||
re-evaluated; <code>Sometimes</code>, indicating that the subscriber may sometimes
|
||
care about the callsite but not always (such as when sampling), or
|
||
<code>Never</code>, indicating that the subscriber never wishes to be notified about
|
||
that callsite. If all active subscribers return <code>Never</code>, a callsite will
|
||
never be enabled unless a new subscriber expresses interest in it.</p>
|
||
<p><code>Subscriber</code>s which require their filters to be run every time an event
|
||
occurs or a span is entered/exited should return <code>Interest::sometimes</code>.
|
||
If a subscriber returns <code>Interest::sometimes</code>, then its <a href="#method.enabled"><code>enabled</code></a> method
|
||
will be called every time an event or span is created from that callsite.</p>
|
||
<p>For example, suppose a sampling subscriber is implemented by
|
||
incrementing a counter every time <code>enabled</code> is called and only returning
|
||
<code>true</code> when the counter is divisible by a specified sampling rate. If
|
||
that subscriber returns <code>Interest::always</code> from <code>register_callsite</code>, then
|
||
the filter will not be re-evaluated once it has been applied to a given
|
||
set of metadata. Thus, the counter will not be incremented, and the span
|
||
or event that corresponds to the metadata will never be <code>enabled</code>.</p>
|
||
<p><code>Subscriber</code>s that need to change their filters occasionally should call
|
||
<a href="../callsite/fn.rebuild_interest_cache.html"><code>rebuild_interest_cache</code></a> to re-evaluate <code>register_callsite</code> for all
|
||
callsites.</p>
|
||
<p>Similarly, if a <code>Subscriber</code> has a filtering strategy that can be
|
||
changed dynamically at runtime, it would need to re-evaluate that filter
|
||
if the cached results have changed.</p>
|
||
<p>A subscriber which manages fanout to multiple other subscribers
|
||
should proxy this decision to all of its child subscribers,
|
||
returning <code>Interest::never</code> only if <em>all</em> such children return
|
||
<code>Interest::never</code>. If the set of subscribers to which spans are
|
||
broadcast may change dynamically, the subscriber should also never
|
||
return <code>Interest::Never</code>, as a new subscriber may be added that <em>is</em>
|
||
interested.</p>
|
||
<h5 id="notes" class="section-header"><a href="#notes">Notes</a></h5>
|
||
<p>This function may be called again when a new subscriber is created or
|
||
when the registry is invalidated.</p>
|
||
<p>If a subscriber returns <code>Interest::never</code> for a particular callsite, it
|
||
<em>may</em> still see spans and events originating from that callsite, if
|
||
another subscriber expressed interest in it.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.max_level_hint" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#197" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.max_level_hint" class="fnname">max_level_hint</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../level_filters/struct.LevelFilter.html" title="struct tracing::level_filters::LevelFilter">LevelFilter</a>></h4></div></summary><div class="docblock"><p>Returns the highest <a href="../struct.Level.html">verbosity level</a> that this <code>Subscriber</code> will
|
||
enable, or <code>None</code>, if the subscriber does not implement level-based
|
||
filtering or chooses not to implement this method.</p>
|
||
<p>If this method returns a <a href="../struct.Level.html"><code>Level</code></a>, it will be used as a hint to
|
||
determine the most verbose level that will be enabled. This will allow
|
||
spans and events which are more verbose than that level to be skipped
|
||
more efficiently. Subscribers which perform filtering are strongly
|
||
encouraged to provide an implementation of this method.</p>
|
||
<p>If the maximum level the subscriber will enable can change over the
|
||
course of its lifetime, it is free to return a different value from
|
||
multiple invocations of this method. However, note that changes in the
|
||
maximum level will <strong>only</strong> be reflected after the callsite <a href="struct.Interest.html"><code>Interest</code></a>
|
||
cache is rebuilt, by calling the <a href="../callsite/fn.rebuild_interest_cache.html"><code>callsite::rebuild_interest_cache</code></a>
|
||
function. Therefore, if the subscriber will change the value returned by
|
||
this method, it is responsible for ensuring that
|
||
<a href="../callsite/fn.rebuild_interest_cache.html"><code>rebuild_interest_cache</code></a> is called after the value of the max
|
||
level changes.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.clone_span" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#349" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.clone_span" class="fnname">clone_span</a>(&self, id: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>) -> <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a></h4></div></summary><div class="docblock"><p>Notifies the subscriber that a <a href="../span/struct.Id.html">span ID</a> has been cloned.</p>
|
||
<p>This function is guaranteed to only be called with span IDs that were
|
||
returned by this subscriber’s <code>new_span</code> function.</p>
|
||
<p>Note that the default implementation of this function this is just the
|
||
identity function, passing through the identifier. However, it can be
|
||
used in conjunction with <a href="trait.Subscriber.html#method.try_close"><code>try_close</code></a> to track the number of handles
|
||
capable of <code>enter</code>ing a span. When all the handles have been dropped
|
||
(i.e., <code>try_close</code> has been called one more time than <code>clone_span</code> for a
|
||
given ID), the subscriber may assume that the span will not be entered
|
||
again. It is then free to deallocate storage for data associated with
|
||
that span, write data from that span to IO, and so on.</p>
|
||
<p>For more unsafe situations, however, if <code>id</code> is itself a pointer of some
|
||
kind this can be used as a hook to “clone” the pointer, depending on
|
||
what that means for the specified pointer.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.drop_span" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#363" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.drop_span" class="fnname">drop_span</a>(&self, _id: <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div></summary><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 0.1.2: <p>use <code>Subscriber::try_close</code> instead</p>
|
||
</div></div><div class="docblock"><p><strong>This method is deprecated.</strong></p>
|
||
<p>Using <code>drop_span</code> may result in subscribers composed using
|
||
<code>tracing-subscriber</code> crate’s <code>Layer</code> trait from observing close events.
|
||
Use <a href="trait.Subscriber.html#method.try_close"><code>try_close</code></a> instead.</p>
|
||
<p>The default implementation of this function does nothing.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.try_close" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#401" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.try_close" class="fnname">try_close</a>(&self, id: <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a></h4></div></summary><div class="docblock"><p>Notifies the subscriber that a <a href="../span/struct.Id.html">span ID</a> has been dropped, and returns
|
||
<code>true</code> if there are now 0 IDs that refer to that span.</p>
|
||
<p>Higher-level libraries providing functionality for composing multiple
|
||
subscriber implementations may use this return value to notify any
|
||
“layered” subscribers that this subscriber considers the span closed.</p>
|
||
<p>The default implementation of this method calls the subscriber’s
|
||
<a href="trait.Subscriber.html#method.drop_span"><code>drop_span</code></a> method and returns <code>false</code>. This means that, unless the
|
||
subscriber overrides the default implementation, close notifications
|
||
will never be sent to any layered subscribers. In general, if the
|
||
subscriber tracks reference counts, this method should be implemented,
|
||
rather than <code>drop_span</code>.</p>
|
||
<p>This function is guaranteed to only be called with span IDs that were
|
||
returned by this subscriber’s <code>new_span</code> function.</p>
|
||
<p>It’s guaranteed that if this function has been called once more than the
|
||
number of times <code>clone_span</code> was called with the same <code>id</code>, then no more
|
||
handles that can enter the span with that <code>id</code> exist. This means that it
|
||
can be used in conjunction with <a href="trait.Subscriber.html#method.clone_span"><code>clone_span</code></a> to track the number of
|
||
handles capable of <code>enter</code>ing a span. When all the handles have been
|
||
dropped (i.e., <code>try_close</code> has been called one more time than
|
||
<code>clone_span</code> for a given ID), the subscriber may assume that the span
|
||
will not be entered again, and should return <code>true</code>. It is then free to
|
||
deallocate storage for data associated with that span, write data from
|
||
that span to IO, and so on.</p>
|
||
<p><strong>Note</strong>: since this function is called when spans are dropped,
|
||
implementations should ensure that they are unwind-safe. Panicking from
|
||
inside of a <code>try_close</code> function may cause a double panic, if the span
|
||
was dropped due to a thread unwinding.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.current_span" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#420" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.current_span" class="fnname">current_span</a>(&self) -> <a class="struct" href="../../tracing_core/span/struct.Current.html" title="struct tracing_core::span::Current">Current</a></h4></div></summary><div class="docblock"><p>Returns a type representing this subscriber’s view of the current span.</p>
|
||
<p>If subscribers track a current span, they should override this function
|
||
to return <a href="../span/struct.Current.html#tymethod.new"><code>Current::new</code></a> if the thread from which this method is
|
||
called is inside a span, or <a href="../span/struct.Current.html#tymethod.none"><code>Current::none</code></a> if the thread is not
|
||
inside a span.</p>
|
||
<p>By default, this returns a value indicating that the subscriber
|
||
does <strong>not</strong> track what span is current. If the subscriber does not
|
||
implement a current span, it should not override this method.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.downcast_raw" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#451" title="goto source code">[src]</a></div><h4 class="code-header">unsafe fn <a href="#method.downcast_raw" class="fnname">downcast_raw</a>(&self, id: <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.pointer.html">*const </a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>If <code>self</code> is the same type as the provided <code>TypeId</code>, returns an untyped
|
||
<code>*const</code> pointer to that type. Otherwise, returns <code>None</code>.</p>
|
||
<p>If you wish to downcast a <code>Subscriber</code>, it is strongly advised to use
|
||
the safe API provided by <a href="#method.downcast_ref"><code>downcast_ref</code></a> instead.</p>
|
||
<p>This API is required for <code>downcast_raw</code> to be a trait method; a method
|
||
signature like <a href="#method.downcast_ref"><code>downcast_ref</code></a> (with a generic type parameter) is not
|
||
object-safe, and thus cannot be a trait method for <code>Subscriber</code>. This
|
||
means that if we only exposed <code>downcast_ref</code>, <code>Subscriber</code>
|
||
implementations could not override the downcasting behavior</p>
|
||
<p>This method may be overridden by “fan out” or “chained” subscriber
|
||
implementations which consist of multiple composed types. Such
|
||
subscribers might allow <code>downcast_raw</code> by returning references to those
|
||
component if they contain components with the given <code>TypeId</code>.</p>
|
||
<h5 id="safety" class="section-header"><a href="#safety">Safety</a></h5>
|
||
<p>The <a href="#method.downcast_ref"><code>downcast_ref</code></a> method expects that the pointer returned by
|
||
<code>downcast_raw</code> is non-null and points to a valid instance of the type
|
||
with the provided <code>TypeId</code>. Failure to ensure this will result in
|
||
undefined behaviour, so implementing <code>downcast_raw</code> is unsafe.</p>
|
||
</div></details></div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#460-478" title="goto source code">[src]</a></div><a href="#impl" class="anchor"></a><h3 class="code-header in-band">impl dyn <a class="trait" href="../trait.Subscriber.html" title="trait tracing::Subscriber">Subscriber</a> + 'static</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#462" title="goto source code">[src]</a></div><a href="#method.is" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.is" class="fnname">is</a><T>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a>, </span></h4></div></summary><div class="docblock"><p>Returns <code>true</code> if this <code>Subscriber</code> is the same type as <code>T</code>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.downcast_ref" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#468" title="goto source code">[src]</a></div><a href="#method.downcast_ref" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.downcast_ref" class="fnname">downcast_ref</a><T>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&</a>T> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a>, </span></h4></div></summary><div class="docblock"><p>Returns some reference to this <code>Subscriber</code> value if it is of type <code>T</code>,
|
||
or <code>None</code> if it isn’t.</p>
|
||
</div></details></div></details><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-Subscriber-for-Arc%3Cdyn%20Subscriber%20+%20Sync%20+%20Send%20+%20%27static%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#675-750" title="goto source code">[src]</a></div><a href="#impl-Subscriber-for-Arc%3Cdyn%20Subscriber%20+%20Sync%20+%20Send%20+%20%27static%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="../trait.Subscriber.html" title="trait tracing::Subscriber">Subscriber</a> for <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><dyn <a class="trait" href="../trait.Subscriber.html" title="trait tracing::Subscriber">Subscriber</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static></h3></div></summary><div class="impl-items"><div id="method.register_callsite-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#677" title="goto source code">[src]</a></div><a href="#method.register_callsite-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.register_callsite" class="fnname">register_callsite</a>(<br> &self, <br> metadata: &'static <a class="struct" href="../struct.Metadata.html" title="struct tracing::Metadata">Metadata</a><'static><br>) -> <a class="struct" href="struct.Interest.html" title="struct tracing::subscriber::Interest">Interest</a></h4></div><div id="method.enabled" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#682" title="goto source code">[src]</a></div><a href="#method.enabled" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.enabled" class="fnname">enabled</a>(&self, metadata: &<a class="struct" href="../struct.Metadata.html" title="struct tracing::Metadata">Metadata</a><'_>) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a></h4></div><div id="method.max_level_hint-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#687" title="goto source code">[src]</a></div><a href="#method.max_level_hint-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.max_level_hint" class="fnname">max_level_hint</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../level_filters/struct.LevelFilter.html" title="struct tracing::level_filters::LevelFilter">LevelFilter</a>></h4></div><div id="method.new_span" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#692" title="goto source code">[src]</a></div><a href="#method.new_span" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.new_span" class="fnname">new_span</a>(&self, span: &<a class="struct" href="../span/struct.Attributes.html" title="struct tracing::span::Attributes">Attributes</a><'_>) -> <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a></h4></div><div id="method.record" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#697" title="goto source code">[src]</a></div><a href="#method.record" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.record" class="fnname">record</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>, values: &<a class="struct" href="../span/struct.Record.html" title="struct tracing::span::Record">Record</a><'_>)</h4></div><div id="method.record_follows_from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#702" title="goto source code">[src]</a></div><a href="#method.record_follows_from" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.record_follows_from" class="fnname">record_follows_from</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>, follows: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div><div id="method.event" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#707" title="goto source code">[src]</a></div><a href="#method.event" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.event" class="fnname">event</a>(&self, event: &<a class="struct" href="../event/struct.Event.html" title="struct tracing::event::Event">Event</a><'_>)</h4></div><div id="method.enter" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#712" title="goto source code">[src]</a></div><a href="#method.enter" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.enter" class="fnname">enter</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div><div id="method.exit" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#717" title="goto source code">[src]</a></div><a href="#method.exit" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.exit" class="fnname">exit</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div><div id="method.clone_span-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#722" title="goto source code">[src]</a></div><a href="#method.clone_span-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.clone_span" class="fnname">clone_span</a>(&self, id: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>) -> <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a></h4></div><div id="method.try_close-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#727" title="goto source code">[src]</a></div><a href="#method.try_close-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.try_close" class="fnname">try_close</a>(&self, id: <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a></h4></div><details class="rustdoc-toggle method-toggle" open><summary><div id="method.drop_span-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#733" title="goto source code">[src]</a></div><a href="#method.drop_span-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.drop_span" class="fnname">drop_span</a>(&self, id: <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div></summary><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 0.1.2: <p>use <code>Subscriber::try_close</code> instead</p>
|
||
</div></div></details><div id="method.current_span-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#738" title="goto source code">[src]</a></div><a href="#method.current_span-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.current_span" class="fnname">current_span</a>(&self) -> <a class="struct" href="../../tracing_core/span/struct.Current.html" title="struct tracing_core::span::Current">Current</a></h4></div><div id="method.downcast_raw-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#743" title="goto source code">[src]</a></div><a href="#method.downcast_raw-1" class="anchor"></a><h4 class="code-header">pub unsafe fn <a href="#method.downcast_raw" class="fnname">downcast_raw</a>(&self, id: <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.pointer.html">*const </a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-Subscriber-for-Box%3Cdyn%20Subscriber%20+%20Sync%20+%20Send%20+%20%27static%2C%20Global%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#598-673" title="goto source code">[src]</a></div><a href="#impl-Subscriber-for-Box%3Cdyn%20Subscriber%20+%20Sync%20+%20Send%20+%20%27static%2C%20Global%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="../trait.Subscriber.html" title="trait tracing::Subscriber">Subscriber</a> for <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="../trait.Subscriber.html" title="trait tracing::Subscriber">Subscriber</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static, <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>></h3></div></summary><div class="impl-items"><div id="method.register_callsite-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#600" title="goto source code">[src]</a></div><a href="#method.register_callsite-2" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.register_callsite" class="fnname">register_callsite</a>(<br> &self, <br> metadata: &'static <a class="struct" href="../struct.Metadata.html" title="struct tracing::Metadata">Metadata</a><'static><br>) -> <a class="struct" href="struct.Interest.html" title="struct tracing::subscriber::Interest">Interest</a></h4></div><div id="method.enabled-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#605" title="goto source code">[src]</a></div><a href="#method.enabled-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.enabled" class="fnname">enabled</a>(&self, metadata: &<a class="struct" href="../struct.Metadata.html" title="struct tracing::Metadata">Metadata</a><'_>) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a></h4></div><div id="method.max_level_hint-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#610" title="goto source code">[src]</a></div><a href="#method.max_level_hint-2" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.max_level_hint" class="fnname">max_level_hint</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../level_filters/struct.LevelFilter.html" title="struct tracing::level_filters::LevelFilter">LevelFilter</a>></h4></div><div id="method.new_span-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#615" title="goto source code">[src]</a></div><a href="#method.new_span-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.new_span" class="fnname">new_span</a>(&self, span: &<a class="struct" href="../span/struct.Attributes.html" title="struct tracing::span::Attributes">Attributes</a><'_>) -> <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a></h4></div><div id="method.record-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#620" title="goto source code">[src]</a></div><a href="#method.record-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.record" class="fnname">record</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>, values: &<a class="struct" href="../span/struct.Record.html" title="struct tracing::span::Record">Record</a><'_>)</h4></div><div id="method.record_follows_from-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#625" title="goto source code">[src]</a></div><a href="#method.record_follows_from-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.record_follows_from" class="fnname">record_follows_from</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>, follows: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div><div id="method.event-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#630" title="goto source code">[src]</a></div><a href="#method.event-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.event" class="fnname">event</a>(&self, event: &<a class="struct" href="../event/struct.Event.html" title="struct tracing::event::Event">Event</a><'_>)</h4></div><div id="method.enter-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#635" title="goto source code">[src]</a></div><a href="#method.enter-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.enter" class="fnname">enter</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div><div id="method.exit-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#640" title="goto source code">[src]</a></div><a href="#method.exit-1" class="anchor"></a><h4 class="code-header">pub fn <a href="#tymethod.exit" class="fnname">exit</a>(&self, span: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div><div id="method.clone_span-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#645" title="goto source code">[src]</a></div><a href="#method.clone_span-2" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.clone_span" class="fnname">clone_span</a>(&self, id: &<a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>) -> <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a></h4></div><div id="method.try_close-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#650" title="goto source code">[src]</a></div><a href="#method.try_close-2" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.try_close" class="fnname">try_close</a>(&self, id: <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a></h4></div><details class="rustdoc-toggle method-toggle" open><summary><div id="method.drop_span-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#656" title="goto source code">[src]</a></div><a href="#method.drop_span-2" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.drop_span" class="fnname">drop_span</a>(&self, id: <a class="struct" href="../span/struct.Id.html" title="struct tracing::span::Id">Id</a>)</h4></div></summary><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 0.1.2: <p>use <code>Subscriber::try_close</code> instead</p>
|
||
</div></div></details><div id="method.current_span-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#661" title="goto source code">[src]</a></div><a href="#method.current_span-2" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.current_span" class="fnname">current_span</a>(&self) -> <a class="struct" href="../../tracing_core/span/struct.Current.html" title="struct tracing_core::span::Current">Current</a></h4></div><div id="method.downcast_raw-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#666" title="goto source code">[src]</a></div><a href="#method.downcast_raw-2" class="anchor"></a><h4 class="code-header">pub unsafe fn <a href="#method.downcast_raw" class="fnname">downcast_raw</a>(&self, id: <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.pointer.html">*const </a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><div id="impl-Subscriber" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/tracing_core/subscriber.rs.html#573-596" title="goto source code">[src]</a></div><a href="#impl-Subscriber" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="../trait.Subscriber.html" title="trait tracing::Subscriber">Subscriber</a> for <a class="struct" href="struct.NoSubscriber.html" title="struct tracing::subscriber::NoSubscriber">NoSubscriber</a></h3></div></div><script type="text/javascript" src="../../implementors/tracing_core/subscriber/trait.Subscriber.js" async></script></section><section id="search" class="content hidden"></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tracing" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.59.0 (9d1b2106e 2022-02-23)" ></div>
|
||
</body></html> |