subscriber: document that directives are comma-separated (#1637)

Previously, the documentation explained that an `EnvFilter` consisted
of multiple directives, but didn't describe how to actually put
these directives together.  (My first guess was "with spaces", but
that was wrong.)

This patch changes the documentation to say that directives are
comma-separated, and gives an example of a comma-separated filter.
This commit is contained in:
Nick Mathewson 2021-10-13 14:59:35 -04:00 committed by Eliza Weisman
parent 8c998447f6
commit 470661a439

View File

@ -28,7 +28,7 @@ use tracing_core::{
///
/// # Directives
///
/// A filter consists of one or more directives which match on [`Span`]s and [`Event`]s.
/// A filter consists of one or more comma-separated directives which match on [`Span`]s and [`Event`]s.
/// Each directive may have a corresponding maximum verbosity [`level`] which
/// enables (e.g., _selects for_) spans and events that match. Like `log`,
/// `tracing` considers less exclusive levels (like `trace` or `info`) to be more
@ -77,6 +77,9 @@ use tracing_core::{
/// - `tokio::net=info` will enable all spans or events that:
/// - have the `tokio::net` target,
/// - at the level `info` or above.
/// - `warn,tokio::net=info` will enable all spans and events that:
/// - are at the level `warn` or above, *or*
/// - have the `tokio::net` target at the level `info` or above.
/// - `my_crate[span_a]=trace` will enable all spans and events that:
/// - are within the `span_a` span or named `span_a` _if_ `span_a` has the target `my_crate`,
/// - at the level `trace` or above.