Skip to content

Commit

Permalink
Apply examples suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: David Barsky <me@davidbarsky.com>
  • Loading branch information
hawkw and davidbarsky authored Sep 2, 2021
1 parent fdde9ea commit 4c5249b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
16 changes: 6 additions & 10 deletions tracing-subscriber/src/filter/layer_filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,7 @@ where
/// metadata.target() == "interesting_target"
/// });
///
/// let my_layer = // ...
/// # filter::LevelFilter::INFO;
/// let my_layer = tracing_subscriber::fmt::layer();
///
/// tracing_subscriber::registry()
/// // Add the filter to the layer
Expand Down Expand Up @@ -466,8 +465,7 @@ where
/// metadata.target() == "interesting_target"
/// });
///
/// let my_layer = // ...
/// # tracing_subscriber::filter::LevelFilter::INFO;
/// let my_layer = tracing_subscriber::fmt::layer();
///
/// tracing_subscriber::registry()
/// .with(my_layer.with_filter(my_filter))
Expand Down Expand Up @@ -520,8 +518,7 @@ where
/// // be the same for a particular `Metadata`.
/// .cacheable();
///
/// let my_layer = // some layer ...
/// # filter::LevelFilter::INFO
/// let my_layer = tracing_subscriber::fmt::layer()
/// .with_filter(target_filter_fn);
/// # // just so that types are inferred correctly...
/// # drop(my_layer.with_subscriber(tracing_subscriber::registry()));
Expand Down Expand Up @@ -552,8 +549,7 @@ where
/// // `Metadata`.
/// .cacheable();
///
/// let my_layer = // some layer ...
/// # filter::LevelFilter::INFO
/// let my_layer = tracing_subscriber::fmt::layer()
/// .with_filter(span_name_filter_fn);
/// # // just so that types are inferred correctly...
/// # drop(my_layer.with_subscriber(tracing_subscriber::registry()));
Expand Down Expand Up @@ -617,8 +613,8 @@ where
/// // below, set the max level hint
/// .with_max_level_hint(LevelFilter::INFO);
///
/// let my_layer = //
/// # LevelFilter::INFO;
/// let my_layer = tracing_subscriber::fmt::layer();
///
/// tracing_subscriber::registry()
/// .with(my_layer.with_filter(my_filter))
/// .init();
Expand Down
10 changes: 4 additions & 6 deletions tracing-subscriber/src/layer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,12 @@ pub use self::{context::*, layered::*};
/// }));
///
/// // A general-purpose logging layer.
/// let log_layer = // ...
/// # filter::LevelFilter::INFO;
/// let fmt_layer = tracing_subscriber::fmt::layer();
///
/// // Build a subscriber that combines the access log and stdout log
/// // layers.
/// tracing_subscriber::registry()
/// .with(log_layer)
/// .with(fmt_layer)
/// .with(access_log)
/// .init();
/// ```
Expand All @@ -269,8 +268,7 @@ pub use self::{context::*, layered::*};
///
/// let access_log = // ...
/// # LevelFilter::INFO;
/// let log_layer = // ...
/// # LevelFilter::INFO;
/// let fmt_layer = tracing_subscriber::fmt::layer();
///
/// tracing_subscriber::registry()
/// // Add the filter for the "http_access" target to the access
Expand All @@ -280,7 +278,7 @@ pub use self::{context::*, layered::*};
/// })))
/// // Add a filter for spans and events with the INFO level
/// // and below to the logging layer.
/// .with(log_layer.with_filter(LevelFilter::INFO))
/// .with(fmt_layer.with_filter(LevelFilter::INFO))
/// .init();
///
/// // Neither layer will observe this event
Expand Down

0 comments on commit 4c5249b

Please sign in to comment.