edlang/tracing_subscriber/fmt/trait.MakeWriter.html
2024-02-27 06:59:44 +00:00

148 lines
35 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="A type that can create `io::Write` instances."><title>MakeWriter in tracing_subscriber::fmt - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="tracing_subscriber" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-feafe1bb7466e4bd.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.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="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="logo-container" href="../../tracing_subscriber/index.html"><img src="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../tracing_subscriber/index.html"><img src="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png" alt="logo"></a><h2><a href="../../tracing_subscriber/index.html">tracing_subscriber</a><span class="version">0.3.18</span></h2></div><h2 class="location"><a href="#">MakeWriter</a></h2><div class="sidebar-elems"><section><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Writer">Writer</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.make_writer">make_writer</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.make_writer_for">make_writer_for</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-MakeWriter%3C'a%3E-for-Arc%3CW%3E">Arc&lt;W&gt;</a></li><li><a href="#impl-MakeWriter%3C'a%3E-for-File">File</a></li><li><a href="#impl-MakeWriter%3C'a%3E-for-Mutex%3CW%3E">Mutex&lt;W&gt;</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In tracing_subscriber::fmt</a></h2></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../tracing_subscriber/all.html" title="show sidebar"></a></div><input class="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"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="../index.html">tracing_subscriber</a>::<wbr><a href="index.html">fmt</a>::<wbr><a class="trait" href="#">MakeWriter</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/tracing_subscriber/fmt/writer.rs.html#95-209">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub trait MakeWriter&lt;'a&gt; {
type <a href="#associatedtype.Writer" class="associatedtype">Writer</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a>;
// Required method
fn <a href="#tymethod.make_writer" class="fn">make_writer</a>(&amp;'a self) -&gt; Self::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a>;
// Provided method
fn <a href="#method.make_writer_for" class="fn">make_writer_for</a>(&amp;'a self, meta: &amp;<a class="struct" href="../../tracing_core/metadata/struct.Metadata.html" title="struct tracing_core::metadata::Metadata">Metadata</a>&lt;'_&gt;) -&gt; Self::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A type that can create <a href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write"><code>io::Write</code></a> instances.</p>
<p><code>MakeWriter</code> is used by <a href="struct.Layer.html" title="struct tracing_subscriber::fmt::Layer"><code>fmt::Layer</code></a> or <a href="struct.Subscriber.html" title="struct tracing_subscriber::fmt::Subscriber"><code>fmt::Subscriber</code></a> to print
formatted text representations of <a href="../../tracing_core/event/struct.Event.html" title="struct tracing_core::event::Event"><code>Event</code></a>s.</p>
<p>This trait is already implemented for function pointers and
immutably-borrowing closures that return an instance of <a href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write"><code>io::Write</code></a>, such
as <a href="https://doc.rust-lang.org/1.76.0/std/io/stdio/fn.stdout.html" title="fn std::io::stdio::stdout"><code>io::stdout</code></a> and <a href="https://doc.rust-lang.org/1.76.0/std/io/stdio/fn.stderr.html" title="fn std::io::stdio::stderr"><code>io::stderr</code></a>. Additionally, it is implemented for
<a href="https://doc.rust-lang.org/1.76.0/std/sync/mutex/struct.Mutex.html" title="struct std::sync::mutex::Mutex"><code>std::sync::Mutex</code></a> when the type inside the mutex implements
<a href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write"><code>io::Write</code></a>.</p>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<p>The simplest usage is to pass in a named function that returns a writer. For
example, to log all events to stderr, we could write:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>subscriber = tracing_subscriber::fmt()
.with_writer(std::io::stderr)
.finish();</code></pre></div>
<p>Any function that returns a writer can be used:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>make_my_great_writer() -&gt; <span class="kw">impl </span>std::io::Write {
<span class="comment">// ...
</span>}
<span class="kw">let </span>subscriber = tracing_subscriber::fmt()
.with_writer(make_my_great_writer)
.finish();</code></pre></div>
<p>A closure can be used to introduce arbitrary logic into how the writer is
created. Consider the (admittedly rather silly) example of sending every 5th
event to stderr, and all other events to stdout:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io;
<span class="kw">use </span>std::sync::atomic::{AtomicUsize, Ordering::Relaxed};
<span class="kw">let </span>n = AtomicUsize::new(<span class="number">0</span>);
<span class="kw">let </span>subscriber = tracing_subscriber::fmt()
.with_writer(<span class="kw">move </span>|| -&gt; Box&lt;<span class="kw">dyn </span>io::Write&gt; {
<span class="kw">if </span>n.fetch_add(<span class="number">1</span>, Relaxed) % <span class="number">5 </span>== <span class="number">0 </span>{
Box::new(io::stderr())
} <span class="kw">else </span>{
Box::new(io::stdout())
}
})
.finish();</code></pre></div>
<p>A single instance of a type implementing <a href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write"><code>io::Write</code></a> may be used as a
<code>MakeWriter</code> by wrapping it in a <a href="https://doc.rust-lang.org/1.76.0/std/sync/mutex/struct.Mutex.html" title="struct std::sync::mutex::Mutex"><code>Mutex</code></a>. For example, we could
write to a file like so:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::{fs::File, sync::Mutex};
<span class="kw">let </span>log_file = File::create(<span class="string">"my_cool_trace.log"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>subscriber = tracing_subscriber::fmt()
.with_writer(Mutex::new(log_file))
.finish();</code></pre></div>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Writer" class="method"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#100">source</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a></h4></section></summary><div class="docblock"><p>The concrete <a href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write"><code>io::Write</code></a> implementation returned by <a href="trait.MakeWriter.html#tymethod.make_writer" title="method tracing_subscriber::fmt::MakeWriter::make_writer"><code>make_writer</code></a>.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.make_writer" class="method"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#115">source</a><h4 class="code-header">fn <a href="#tymethod.make_writer" class="fn">make_writer</a>(&amp;'a self) -&gt; Self::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a></h4></section></summary><div class="docblock"><p>Returns an instance of <a href="trait.MakeWriter.html#associatedtype.Writer" title="associated type tracing_subscriber::fmt::MakeWriter::Writer"><code>Writer</code></a>.</p>
<h5 id="implementer-notes"><a href="#implementer-notes">Implementer notes</a></h5>
<p><a href="struct.Layer.html" title="struct tracing_subscriber::fmt::Layer"><code>fmt::Layer</code></a> or <a href="struct.Subscriber.html" title="struct tracing_subscriber::fmt::Subscriber"><code>fmt::Subscriber</code></a> will call this method each time an event is recorded. Ensure any state
that must be saved across writes is not lost when the <a href="trait.MakeWriter.html#associatedtype.Writer" title="associated type tracing_subscriber::fmt::MakeWriter::Writer"><code>Writer</code></a> instance is dropped. If
creating a <a href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write"><code>io::Write</code></a> instance is expensive, be sure to cache it when implementing
<a href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter"><code>MakeWriter</code></a> to improve performance.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.make_writer_for" class="method"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#205-208">source</a><h4 class="code-header">fn <a href="#method.make_writer_for" class="fn">make_writer_for</a>(&amp;'a self, meta: &amp;<a class="struct" href="../../tracing_core/metadata/struct.Metadata.html" title="struct tracing_core::metadata::Metadata">Metadata</a>&lt;'_&gt;) -&gt; Self::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a></h4></section></summary><div class="docblock"><p>Returns a <a href="trait.MakeWriter.html#associatedtype.Writer" title="associated type tracing_subscriber::fmt::MakeWriter::Writer"><code>Writer</code></a> for writing data from the span or event described
by the provided <a href="../../tracing_core/metadata/struct.Metadata.html" title="struct tracing_core::metadata::Metadata"><code>Metadata</code></a>.</p>
<p>By default, this calls <a href="trait.MakeWriter.html#tymethod.make_writer" title="method tracing_subscriber::fmt::MakeWriter::make_writer"><code>self.make_writer()</code></a>, ignoring
the provided metadata, but implementations can override this to provide
metadata-specific behaviors.</p>
<p>This method allows <code>MakeWriter</code> implementations to implement different
behaviors based on the span or event being written. The <code>MakeWriter</code>
type might return different writers based on the provided metadata, or
might write some values to the writer before or after providing it to
the caller.</p>
<p>For example, we might want to write data from spans and events at the
<a href="../../tracing_core/metadata/struct.Level.html#associatedconstant.ERROR" title="associated constant tracing_core::metadata::Level::ERROR"><code>ERROR</code></a> and <a href="../../tracing_core/metadata/struct.Level.html#associatedconstant.WARN" title="associated constant tracing_core::metadata::Level::WARN"><code>WARN</code></a> levels to <code>stderr</code>, and data from spans or events
at lower levels to stdout:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io::{<span class="self">self</span>, Stdout, Stderr, StdoutLock, StderrLock};
<span class="kw">use </span>tracing_subscriber::fmt::writer::MakeWriter;
<span class="kw">use </span>tracing_core::{Metadata, Level};
<span class="kw">pub struct </span>MyMakeWriter {
stdout: Stdout,
stderr: Stderr,
}
<span class="doccomment">/// A lock on either stdout or stderr, depending on the verbosity level
/// of the event being written.
</span><span class="kw">pub enum </span>StdioLock&lt;<span class="lifetime">'a</span>&gt; {
Stdout(StdoutLock&lt;<span class="lifetime">'a</span>&gt;),
Stderr(StderrLock&lt;<span class="lifetime">'a</span>&gt;),
}
<span class="kw">impl</span>&lt;<span class="lifetime">'a</span>&gt; io::Write <span class="kw">for </span>StdioLock&lt;<span class="lifetime">'a</span>&gt; {
<span class="kw">fn </span>write(<span class="kw-2">&amp;mut </span><span class="self">self</span>, buf: <span class="kw-2">&amp;</span>[u8]) -&gt; io::Result&lt;usize&gt; {
<span class="kw">match </span><span class="self">self </span>{
StdioLock::Stdout(lock) =&gt; lock.write(buf),
StdioLock::Stderr(lock) =&gt; lock.write(buf),
}
}
<span class="kw">fn </span>write_all(<span class="kw-2">&amp;mut </span><span class="self">self</span>, buf: <span class="kw-2">&amp;</span>[u8]) -&gt; io::Result&lt;()&gt; {
<span class="comment">// ...
</span>}
<span class="kw">fn </span>flush(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; io::Result&lt;()&gt; {
<span class="comment">// ...
</span>}
}
<span class="kw">impl</span>&lt;<span class="lifetime">'a</span>&gt; MakeWriter&lt;<span class="lifetime">'a</span>&gt; <span class="kw">for </span>MyMakeWriter {
<span class="kw">type </span>Writer = StdioLock&lt;<span class="lifetime">'a</span>&gt;;
<span class="kw">fn </span>make_writer(<span class="kw-2">&amp;</span><span class="lifetime">'a </span><span class="self">self</span>) -&gt; <span class="self">Self</span>::Writer {
<span class="comment">// We must have an implementation of `make_writer` that makes
// a "default" writer without any configuring metadata. Let's
// just return stdout in that case.
</span>StdioLock::Stdout(<span class="self">self</span>.stdout.lock())
}
<span class="kw">fn </span>make_writer_for(<span class="kw-2">&amp;</span><span class="lifetime">'a </span><span class="self">self</span>, meta: <span class="kw-2">&amp;</span>Metadata&lt;<span class="lifetime">'_</span>&gt;) -&gt; <span class="self">Self</span>::Writer {
<span class="comment">// Here's where we can implement our special behavior. We'll
// check if the metadata's verbosity level is WARN or ERROR,
// and return stderr in that case.
</span><span class="kw">if </span>meta.level() &lt;= <span class="kw-2">&amp;</span>Level::WARN {
<span class="kw">return </span>StdioLock::Stderr(<span class="self">self</span>.stderr.lock());
}
<span class="comment">// Otherwise, we'll return stdout.
</span>StdioLock::Stdout(<span class="self">self</span>.stdout.lock())
}
}</code></pre></div>
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-MakeWriter%3C'a%3E-for-File" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#694-699">source</a><a href="#impl-MakeWriter%3C'a%3E-for-File" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt; for <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/fs/struct.File.html" title="struct std::fs::File">File</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Writer-1" class="associatedtype trait-impl"><a href="#associatedtype.Writer-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a> = &amp;'a <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/fs/struct.File.html" title="struct std::fs::File">File</a></h4></section><section id="method.make_writer" class="method trait-impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#696-698">source</a><a href="#method.make_writer" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.make_writer" class="fn">make_writer</a>(&amp;'a self) -&gt; Self::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-MakeWriter%3C'a%3E-for-Arc%3CW%3E" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#684-692">source</a><a href="#impl-MakeWriter%3C'a%3E-for-Arc%3CW%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, W&gt; <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt; for <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;W&gt;<div class="where">where
<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;'a W</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + 'a,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Writer-2" class="associatedtype trait-impl"><a href="#associatedtype.Writer-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a> = <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;'a W</a></h4></section><section id="method.make_writer-1" class="method trait-impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#689-691">source</a><a href="#method.make_writer-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.make_writer" class="fn">make_writer</a>(&amp;'a self) -&gt; Self::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-MakeWriter%3C'a%3E-for-Mutex%3CW%3E" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#789-798">source</a><a href="#impl-MakeWriter%3C'a%3E-for-Mutex%3CW%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, W&gt; <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt; for <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/sync/mutex/struct.Mutex.html" title="struct std::sync::mutex::Mutex">Mutex</a>&lt;W&gt;<div class="where">where
W: <a class="trait" href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + 'a,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Writer-3" class="associatedtype trait-impl"><a href="#associatedtype.Writer-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a> = <a class="struct" href="writer/struct.MutexGuardWriter.html" title="struct tracing_subscriber::fmt::writer::MutexGuardWriter">MutexGuardWriter</a>&lt;'a, W&gt;</h4></section><section id="method.make_writer-2" class="method trait-impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#795-797">source</a><a href="#method.make_writer-2" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.make_writer" class="fn">make_writer</a>(&amp;'a self) -&gt; Self::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-MakeWriter%3C'a%3E-for-TestWriter" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#722-728">source</a><a href="#impl-MakeWriter%3C'a%3E-for-TestWriter" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt; for <a class="struct" href="struct.TestWriter.html" title="struct tracing_subscriber::fmt::TestWriter">TestWriter</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Writer-4" class="associatedtype trait-impl"><a href="#associatedtype.Writer-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a> = <a class="struct" href="struct.TestWriter.html" title="struct tracing_subscriber::fmt::TestWriter">TestWriter</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-MakeWriter%3C'a%3E-for-BoxMakeWriter" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#754-766">source</a><a href="#impl-MakeWriter%3C'a%3E-for-BoxMakeWriter" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt; for <a class="struct" href="writer/struct.BoxMakeWriter.html" title="struct tracing_subscriber::fmt::writer::BoxMakeWriter">BoxMakeWriter</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Writer-5" class="associatedtype trait-impl"><a href="#associatedtype.Writer-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a> = <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + 'a&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-MakeWriter%3C'a%3E-for-Tee%3CA,+B%3E" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#1032-1048">source</a><a href="#impl-MakeWriter%3C'a%3E-for-Tee%3CA,+B%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, A, B&gt; <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt; for <a class="struct" href="writer/struct.Tee.html" title="struct tracing_subscriber::fmt::writer::Tee">Tee</a>&lt;A, B&gt;<div class="where">where
A: <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;,
B: <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Writer-6" class="associatedtype trait-impl"><a href="#associatedtype.Writer-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a> = <a class="struct" href="writer/struct.Tee.html" title="struct tracing_subscriber::fmt::writer::Tee">Tee</a>&lt;&lt;A as <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;&gt;::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a>, &lt;B as <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;&gt;::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a>&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-MakeWriter%3C'a%3E-for-OrElse%3CA,+B%3E" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#1110-1133">source</a><a href="#impl-MakeWriter%3C'a%3E-for-OrElse%3CA,+B%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, A, B, W&gt; <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt; for <a class="struct" href="writer/struct.OrElse.html" title="struct tracing_subscriber::fmt::writer::OrElse">OrElse</a>&lt;A, B&gt;<div class="where">where
A: <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a, Writer = <a class="type" href="writer/type.OptionalWriter.html" title="type tracing_subscriber::fmt::writer::OptionalWriter">OptionalWriter</a>&lt;W&gt;&gt;,
B: <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;,
W: <a class="trait" href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Writer-7" class="associatedtype trait-impl"><a href="#associatedtype.Writer-7" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a> = <a class="enum" href="writer/enum.EitherWriter.html" title="enum tracing_subscriber::fmt::writer::EitherWriter">EitherWriter</a>&lt;W, &lt;B as <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;&gt;::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a>&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-MakeWriter%3C'a%3E-for-F" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#672-682">source</a><a href="#impl-MakeWriter%3C'a%3E-for-F" class="anchor">§</a><h3 class="code-header">impl&lt;'a, F, W&gt; <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt; for F<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>() -&gt; W,
W: <a class="trait" href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Writer-8" class="associatedtype trait-impl"><a href="#associatedtype.Writer-8" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a> = W</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-MakeWriter%3C'a%3E-for-WithFilter%3CM,+F%3E" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#995-1015">source</a><a href="#impl-MakeWriter%3C'a%3E-for-WithFilter%3CM,+F%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, M, F&gt; <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt; for <a class="struct" href="writer/struct.WithFilter.html" title="struct tracing_subscriber::fmt::writer::WithFilter">WithFilter</a>&lt;M, F&gt;<div class="where">where
M: <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;,
F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(&amp;<a class="struct" href="../../tracing_core/metadata/struct.Metadata.html" title="struct tracing_core::metadata::Metadata">Metadata</a>&lt;'_&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Writer-9" class="associatedtype trait-impl"><a href="#associatedtype.Writer-9" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a> = <a class="enum" href="writer/enum.EitherWriter.html" title="enum tracing_subscriber::fmt::writer::EitherWriter">EitherWriter</a>&lt;&lt;M as <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;&gt;::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a>, <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/io/util/struct.Sink.html" title="struct std::io::util::Sink">Sink</a>&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-MakeWriter%3C'a%3E-for-WithMaxLevel%3CM%3E" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#925-941">source</a><a href="#impl-MakeWriter%3C'a%3E-for-WithMaxLevel%3CM%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, M: <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;&gt; <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt; for <a class="struct" href="writer/struct.WithMaxLevel.html" title="struct tracing_subscriber::fmt::writer::WithMaxLevel">WithMaxLevel</a>&lt;M&gt;</h3></section></summary><div class="impl-items"><section id="associatedtype.Writer-10" class="associatedtype trait-impl"><a href="#associatedtype.Writer-10" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a> = <a class="enum" href="writer/enum.EitherWriter.html" title="enum tracing_subscriber::fmt::writer::EitherWriter">EitherWriter</a>&lt;&lt;M as <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;&gt;::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a>, <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/io/util/struct.Sink.html" title="struct std::io::util::Sink">Sink</a>&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-MakeWriter%3C'a%3E-for-WithMinLevel%3CM%3E" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/writer.rs.html#958-974">source</a><a href="#impl-MakeWriter%3C'a%3E-for-WithMinLevel%3CM%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, M: <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;&gt; <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt; for <a class="struct" href="writer/struct.WithMinLevel.html" title="struct tracing_subscriber::fmt::writer::WithMinLevel">WithMinLevel</a>&lt;M&gt;</h3></section></summary><div class="impl-items"><section id="associatedtype.Writer-11" class="associatedtype trait-impl"><a href="#associatedtype.Writer-11" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Writer" class="associatedtype">Writer</a> = <a class="enum" href="writer/enum.EitherWriter.html" title="enum tracing_subscriber::fmt::writer::EitherWriter">EitherWriter</a>&lt;&lt;M as <a class="trait" href="trait.MakeWriter.html" title="trait tracing_subscriber::fmt::MakeWriter">MakeWriter</a>&lt;'a&gt;&gt;::<a class="associatedtype" href="trait.MakeWriter.html#associatedtype.Writer" title="type tracing_subscriber::fmt::MakeWriter::Writer">Writer</a>, <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/io/util/struct.Sink.html" title="struct std::io::util::Sink">Sink</a>&gt;</h4></section></div></details></div><script src="../../trait.impl/tracing_subscriber/fmt/writer/trait.MakeWriter.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>