Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
mladedav committed Mar 2, 2024
1 parent 9afaf72 commit 7afd6b7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
5 changes: 3 additions & 2 deletions tracing-core/src/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,10 @@ pub trait Subscriber: 'static {
/// but values for them won't be recorded at this time.
///
/// ```rust,ignore
/// use tracing::{field::Empty, span};
/// # // This is ignored because we cannot depend on `tracing::span`
/// use tracing::{field::Empty, info_span};
///
/// let mut span = span!("my_span", foo = 3, bar = Empty, baz = Empty);
/// let mut span = info_span!("my_span", foo = 3, bar = Empty, baz = Empty);
///
/// // `Subscriber::record` will be called with a `Record`
/// // containing "bar = false"
Expand Down
3 changes: 3 additions & 0 deletions tracing-subscriber/src/filter/layer_filters/combinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ where
/// above a certain level:
///
/// ```ignore
/// # // Ignored because this uses a private API
/// use tracing_subscriber::{
/// filter::{filter_fn, LevelFilter, combinator::And},
/// prelude::*,
Expand Down Expand Up @@ -216,6 +217,7 @@ where
/// and events with a particular target:
///
/// ```ignore
/// # // Ignored because this uses a private API
/// use tracing_subscriber::{
/// filter::{filter_fn, LevelFilter, combinator::Or},
/// prelude::*,
Expand Down Expand Up @@ -255,6 +257,7 @@ where
/// conjunction with the [`And`] combinator:
///
/// ```ignore
/// # // Ignored because this uses a private API
/// use tracing_subscriber::{
/// filter::{filter_fn, LevelFilter, combinator},
/// prelude::*,
Expand Down
9 changes: 9 additions & 0 deletions tracing-subscriber/src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,12 @@
//! variables, you can use the [`EnvFilter`] as follows:
//!
//! ```rust
//! # #[cfg(feature = "env-filter")]
//! # {
//! use tracing_subscriber::EnvFilter;
//!
//! let filter = EnvFilter::from_default_env();
//! # }
//! ```
//!
//! As mentioned above, the [`EnvFilter`] allows `Span`s and `Event`s to
Expand Down Expand Up @@ -166,6 +169,8 @@
//! Composing an [`EnvFilter`] `Layer` and a [format `Layer`][super::fmt::Layer]:
//!
//! ```rust
//! # #[cfg(feature = "env-filter")]
//! # {
//! use tracing_subscriber::{fmt, EnvFilter};
//! use tracing_subscriber::prelude::*;
//!
Expand All @@ -179,6 +184,7 @@
//! .with(filter_layer)
//! .with(fmt_layer)
//! .init();
//! # }
//! ```
//!
//! [`EnvFilter`]: super::filter::EnvFilter
Expand Down Expand Up @@ -1231,10 +1237,13 @@ pub fn try_init() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
/// If the `env-filter` feature is enabled, this is shorthand for
///
/// ```rust
/// # #[cfg(feature = "env-filter")]
/// # {
/// # use tracing_subscriber::EnvFilter;
/// tracing_subscriber::fmt()
/// .with_env_filter(EnvFilter::from_default_env())
/// .init();
/// # }
/// ```
///
/// # Panics
Expand Down
3 changes: 3 additions & 0 deletions tracing-subscriber/src/fmt/time/time_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,10 @@ impl OffsetTime<well_known::Rfc3339> {
/// ```
/// use tracing_subscriber::fmt::time::OffsetTime;
///
/// # /*
/// #[tokio::main]
/// # */
/// # #[tokio::main(flavor = "current_thread")]
/// async fn run() {
/// tracing::info!("runtime initialized");
///
Expand Down
7 changes: 4 additions & 3 deletions tracing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@
//! fields using `fmt::Debug`.
//!
//! For example:
//! ```ignore
//! # // this doctest is ignored because we don't have a way to say
//! # // that it should only be run with cfg(feature = "attributes")
//! ```
//! # #[cfg(feature = "attributes")]
//! # {
//! use tracing::{Level, event, instrument};
//!
//! #[instrument]
Expand All @@ -168,6 +168,7 @@
//! // ...
//! }
//! # fn main() {}
//! # }
//! ```
//!
//! For functions which don't have built-in tracing support and can't have
Expand Down
6 changes: 3 additions & 3 deletions tracing/src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ impl Span {
/// the future yields.
///
/// `Instrument` can be used with an async block inside an async function:
/// ```ignore
/// ```rust
/// # use tracing::info_span;
/// use tracing::Instrument;
///
Expand All @@ -686,7 +686,7 @@ impl Span {
///
/// It can also be used to instrument calls to async functions at the
/// callsite:
/// ```ignore
/// ```rust
/// # use tracing::debug_span;
/// use tracing::Instrument;
///
Expand All @@ -703,7 +703,7 @@ impl Span {
/// * The [`#[instrument]` attribute macro][attr] can automatically generate
/// correct code when used on an async function:
///
/// ```ignore
/// ```rust
/// # async fn some_other_async_function() {}
/// #[tracing::instrument(level = "info")]
/// async fn my_async_function() {
Expand Down

0 comments on commit 7afd6b7

Please sign in to comment.