edlang/tracing_subscriber/fmt/format/index.html
2024-02-13 06:38:44 +00:00

38 lines
13 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="Formatters for logging `tracing` events."><title>tracing_subscriber::fmt::format - 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 mod"><!--[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="#">Module format</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></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>Module <a href="../../index.html">tracing_subscriber</a>::<wbr><a href="../index.html">fmt</a>::<wbr><a class="mod" href="#">format</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/format/mod.rs.html#1-2179">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Formatters for logging <code>tracing</code> events.</p>
<p>This module provides several formatter implementations, as well as utilities
for implementing custom formatters.</p>
<h2 id="formatters"><a href="#formatters">Formatters</a></h2>
<p>This module provides a number of formatter implementations:</p>
<ul>
<li>
<p><a href="struct.Full.html" title="struct tracing_subscriber::fmt::format::Full"><code>Full</code></a>: The default formatter. This emits human-readable,
single-line logs for each event that occurs, with the current span context
displayed before the formatted representation of the event. See
<a href="struct.Full.html#example-output" title="struct tracing_subscriber::fmt::format::Full">here</a> for sample output.</p>
</li>
<li>
<p><a href="struct.Compact.html" title="struct tracing_subscriber::fmt::format::Compact"><code>Compact</code></a>: A variant of the default formatter, optimized for
short line lengths. Fields from the current span context are appended to
the fields of the formatted event, and span names are not shown; the
verbosity level is abbreviated to a single character. See
<a href="struct.Compact.html#example-output" title="struct tracing_subscriber::fmt::format::Compact">here</a> for sample output.</p>
</li>
<li>
<p><a href="struct.Pretty.html" title="struct tracing_subscriber::fmt::format::Pretty"><code>Pretty</code></a>: Emits excessively pretty, multi-line logs, optimized
for human readability. This is primarily intended to be used in local
development and debugging, or for command-line applications, where
automated analysis and compact storage of logs is less of a priority than
readability and visual appeal. See <a href="struct.Pretty.html#example-output" title="struct tracing_subscriber::fmt::format::Pretty">here</a>
for sample output.</p>
</li>
<li>
<p>[<code>Json</code>]: Outputs newline-delimited JSON logs. This is intended
for production use with systems where structured logs are consumed as JSON
by analysis and viewing tools. The JSON output is not optimized for human
readability. See <a href="Json#example-output">here</a> for sample output.</p>
</li>
</ul>
</div></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Compact.html" title="struct tracing_subscriber::fmt::format::Compact">Compact</a></div><div class="desc docblock-short">Marker for <a href="struct.Format.html" title="struct tracing_subscriber::fmt::format::Format"><code>Format</code></a> that indicates that the compact log format should be used.</div></li><li><div class="item-name"><a class="struct" href="struct.DefaultFields.html" title="struct tracing_subscriber::fmt::format::DefaultFields">DefaultFields</a></div><div class="desc docblock-short">The default <a href="../trait.FormatFields.html" title="trait tracing_subscriber::fmt::FormatFields"><code>FormatFields</code></a> implementation.</div></li><li><div class="item-name"><a class="struct" href="struct.DefaultVisitor.html" title="struct tracing_subscriber::fmt::format::DefaultVisitor">DefaultVisitor</a></div><div class="desc docblock-short">The <a href="../../field/trait.Visit.html" title="trait tracing_subscriber::field::Visit">visitor</a> produced by <a href="struct.DefaultFields.html" title="struct tracing_subscriber::fmt::format::DefaultFields"><code>DefaultFields</code></a>s <a href="../../field/trait.MakeVisitor.html" title="trait tracing_subscriber::field::MakeVisitor"><code>MakeVisitor</code></a> implementation.</div></li><li><div class="item-name"><a class="struct" href="struct.FieldFn.html" title="struct tracing_subscriber::fmt::format::FieldFn">FieldFn</a></div><div class="desc docblock-short">A <a href="../trait.FormatFields.html" title="trait tracing_subscriber::fmt::FormatFields"><code>FormatFields</code></a> implementation that formats fields by calling a function
or closure.</div></li><li><div class="item-name"><a class="struct" href="struct.FieldFnVisitor.html" title="struct tracing_subscriber::fmt::format::FieldFnVisitor">FieldFnVisitor</a></div><div class="desc docblock-short">The <a href="../../field/trait.Visit.html" title="trait tracing_subscriber::field::Visit">visitor</a> produced by <a href="struct.FieldFn.html" title="struct tracing_subscriber::fmt::format::FieldFn"><code>FieldFn</code></a>s <a href="../../field/trait.MakeVisitor.html" title="trait tracing_subscriber::field::MakeVisitor"><code>MakeVisitor</code></a> implementation.</div></li><li><div class="item-name"><a class="struct" href="struct.FmtSpan.html" title="struct tracing_subscriber::fmt::format::FmtSpan">FmtSpan</a></div><div class="desc docblock-short">Configures what points in the span lifecycle are logged as events.</div></li><li><div class="item-name"><a class="struct" href="struct.Format.html" title="struct tracing_subscriber::fmt::format::Format">Format</a></div><div class="desc docblock-short">A pre-configured event formatter.</div></li><li><div class="item-name"><a class="struct" href="struct.Full.html" title="struct tracing_subscriber::fmt::format::Full">Full</a></div><div class="desc docblock-short">Marker for <a href="struct.Format.html" title="struct tracing_subscriber::fmt::format::Format"><code>Format</code></a> that indicates that the default log format should be used.</div></li><li><div class="item-name"><a class="struct" href="struct.Pretty.html" title="struct tracing_subscriber::fmt::format::Pretty">Pretty</a></div><div class="desc docblock-short">An excessively pretty, human-readable event formatter.</div></li><li><div class="item-name"><a class="struct" href="struct.PrettyFields.html" title="struct tracing_subscriber::fmt::format::PrettyFields">PrettyFields</a></div><div class="desc docblock-short">An excessively pretty, human-readable <a href="../../field/trait.MakeVisitor.html" title="trait tracing_subscriber::field::MakeVisitor"><code>MakeVisitor</code></a> implementation.</div></li><li><div class="item-name"><a class="struct" href="struct.PrettyVisitor.html" title="struct tracing_subscriber::fmt::format::PrettyVisitor">PrettyVisitor</a></div><div class="desc docblock-short">The <a href="../../field/trait.Visit.html" title="trait tracing_subscriber::field::Visit">visitor</a> produced by <a href="struct.Pretty.html" title="struct tracing_subscriber::fmt::format::Pretty"><code>Pretty</code></a>s <a href="../../field/trait.MakeVisitor.html" title="trait tracing_subscriber::field::MakeVisitor"><code>MakeVisitor</code></a> implementation.</div></li><li><div class="item-name"><a class="struct" href="struct.Writer.html" title="struct tracing_subscriber::fmt::format::Writer">Writer</a></div><div class="desc docblock-short">A writer to which formatted representations of spans and events are written.</div></li></ul><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.FormatEvent.html" title="trait tracing_subscriber::fmt::format::FormatEvent">FormatEvent</a></div><div class="desc docblock-short">A type that can format a tracing <a href="../../../tracing_core/event/struct.Event.html" title="struct tracing_core::event::Event"><code>Event</code></a> to a <a href="struct.Writer.html" title="struct tracing_subscriber::fmt::format::Writer"><code>Writer</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.FormatFields.html" title="trait tracing_subscriber::fmt::format::FormatFields">FormatFields</a></div><div class="desc docblock-short">A type that can format a <a href="../../field/trait.RecordFields.html" title="trait tracing_subscriber::field::RecordFields">set of fields</a> to a <a href="struct.Writer.html" title="struct tracing_subscriber::fmt::format::Writer"><code>Writer</code></a>.</div></li></ul><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.debug_fn.html" title="fn tracing_subscriber::fmt::format::debug_fn">debug_fn</a></div><div class="desc docblock-short">Returns a <a href="../trait.FormatFields.html" title="trait tracing_subscriber::fmt::FormatFields"><code>FormatFields</code></a> implementation that formats fields using the
provided function or closure.</div></li><li><div class="item-name"><a class="fn" href="fn.format.html" title="fn tracing_subscriber::fmt::format::format">format</a></div><div class="desc docblock-short">Returns the default configuration for an [event formatter].</div></li></ul></section></div></main></body></html>