edlang/tracing_subscriber/fmt/format/index.html
2024-07-26 09:42:18 +00:00

37 lines
12 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><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-dd39b87e5fcfba68.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.80.0 (051478957 2024-07-21)" data-channel="1.80.0" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-df360f571f6edeae.css"></noscript><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" title="show sidebar"></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"><rustdoc-search></rustdoc-search><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">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 class="doc-anchor" href="#formatters">§</a>Formatters</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">Structs<a href="#structs" class="anchor">§</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">Traits<a href="#traits" class="anchor">§</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">Functions<a href="#functions" class="anchor">§</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>