Skip to content

Commit 4c5249b

Browse files
hawkwdavidbarsky
andauthored
Apply examples suggestions from code review
Co-authored-by: David Barsky <me@davidbarsky.com>
1 parent fdde9ea commit 4c5249b

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

tracing-subscriber/src/filter/layer_filters.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,7 @@ where
424424
/// metadata.target() == "interesting_target"
425425
/// });
426426
///
427-
/// let my_layer = // ...
428-
/// # filter::LevelFilter::INFO;
427+
/// let my_layer = tracing_subscriber::fmt::layer();
429428
///
430429
/// tracing_subscriber::registry()
431430
/// // Add the filter to the layer
@@ -466,8 +465,7 @@ where
466465
/// metadata.target() == "interesting_target"
467466
/// });
468467
///
469-
/// let my_layer = // ...
470-
/// # tracing_subscriber::filter::LevelFilter::INFO;
468+
/// let my_layer = tracing_subscriber::fmt::layer();
471469
///
472470
/// tracing_subscriber::registry()
473471
/// .with(my_layer.with_filter(my_filter))
@@ -520,8 +518,7 @@ where
520518
/// // be the same for a particular `Metadata`.
521519
/// .cacheable();
522520
///
523-
/// let my_layer = // some layer ...
524-
/// # filter::LevelFilter::INFO
521+
/// let my_layer = tracing_subscriber::fmt::layer()
525522
/// .with_filter(target_filter_fn);
526523
/// # // just so that types are inferred correctly...
527524
/// # drop(my_layer.with_subscriber(tracing_subscriber::registry()));
@@ -552,8 +549,7 @@ where
552549
/// // `Metadata`.
553550
/// .cacheable();
554551
///
555-
/// let my_layer = // some layer ...
556-
/// # filter::LevelFilter::INFO
552+
/// let my_layer = tracing_subscriber::fmt::layer()
557553
/// .with_filter(span_name_filter_fn);
558554
/// # // just so that types are inferred correctly...
559555
/// # drop(my_layer.with_subscriber(tracing_subscriber::registry()));
@@ -617,8 +613,8 @@ where
617613
/// // below, set the max level hint
618614
/// .with_max_level_hint(LevelFilter::INFO);
619615
///
620-
/// let my_layer = //
621-
/// # LevelFilter::INFO;
616+
/// let my_layer = tracing_subscriber::fmt::layer();
617+
///
622618
/// tracing_subscriber::registry()
623619
/// .with(my_layer.with_filter(my_filter))
624620
/// .init();

tracing-subscriber/src/layer/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,12 @@ pub use self::{context::*, layered::*};
248248
/// }));
249249
///
250250
/// // A general-purpose logging layer.
251-
/// let log_layer = // ...
252-
/// # filter::LevelFilter::INFO;
251+
/// let fmt_layer = tracing_subscriber::fmt::layer();
253252
///
254253
/// // Build a subscriber that combines the access log and stdout log
255254
/// // layers.
256255
/// tracing_subscriber::registry()
257-
/// .with(log_layer)
256+
/// .with(fmt_layer)
258257
/// .with(access_log)
259258
/// .init();
260259
/// ```
@@ -269,8 +268,7 @@ pub use self::{context::*, layered::*};
269268
///
270269
/// let access_log = // ...
271270
/// # LevelFilter::INFO;
272-
/// let log_layer = // ...
273-
/// # LevelFilter::INFO;
271+
/// let fmt_layer = tracing_subscriber::fmt::layer();
274272
///
275273
/// tracing_subscriber::registry()
276274
/// // Add the filter for the "http_access" target to the access
@@ -280,7 +278,7 @@ pub use self::{context::*, layered::*};
280278
/// })))
281279
/// // Add a filter for spans and events with the INFO level
282280
/// // and below to the logging layer.
283-
/// .with(log_layer.with_filter(LevelFilter::INFO))
281+
/// .with(fmt_layer.with_filter(LevelFilter::INFO))
284282
/// .init();
285283
///
286284
/// // Neither layer will observe this event

0 commit comments

Comments
 (0)