diff --git a/tracing-serde/src/lib.rs b/tracing-serde/src/lib.rs index 815ea4f47..e96f5982e 100644 --- a/tracing-serde/src/lib.rs +++ b/tracing-serde/src/lib.rs @@ -375,6 +375,7 @@ where S: SerializeMap, { #[cfg(all(tracing_unstable, feature = "valuable"))] + #[cfg_attr(docsrs, doc(cfg(all(tracing_unstable, feature = "valuable"))))] fn record_value(&mut self, field: &Field, value: valuable_crate::Value<'_>) { if self.state.is_ok() { self.state = self @@ -436,6 +437,7 @@ where S: SerializeStruct, { #[cfg(all(tracing_unstable, feature = "valuable"))] + #[cfg_attr(docsrs, doc(cfg(all(tracing_unstable, feature = "valuable"))))] fn record_value(&mut self, field: &Field, value: valuable_crate::Value<'_>) { if self.state.is_ok() { self.state = self diff --git a/tracing-subscriber/src/lib.rs b/tracing-subscriber/src/lib.rs index 8f390e19e..97e35d03d 100644 --- a/tracing-subscriber/src/lib.rs +++ b/tracing-subscriber/src/lib.rs @@ -103,6 +103,37 @@ //! tracing-subscriber = { version = "0.3", default-features = false, features = ["alloc"] } //! ``` //! +//! ### Unstable Features +//! +//! These feature flags enable **unstable** features. The public API may break in 0.1.x +//! releases. To enable these features, the `--cfg tracing_unstable` must be passed to +//! `rustc` when compiling. +//! +//! The following unstable feature flags are currently available: +//! +//! * `valuable`: Enables support for serializing values recorded using the +//! [`valuable`] crate as structured JSON in the [`format::Json`] formatter. +//! +//! #### Enabling Unstable Features +//! +//! The easiest way to set the `tracing_unstable` cfg is to use the `RUSTFLAGS` +//! env variable when running `cargo` commands: +//! +//! ```shell +//! RUSTFLAGS="--cfg tracing_unstable" cargo build +//! ``` +//! Alternatively, the following can be added to the `.cargo/config` file in a +//! project to automatically enable the cfg flag for that project: +//! +//! ```toml +//! [build] +//! rustflags = ["--cfg", "tracing_unstable"] +//! ``` +//! +//! [feature flags]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section +//! [`valuable`]: https://crates.io/crates/valuable +//! [`format::Json`]: crate::fmt::format::Json +//! //! ## Supported Rust Versions //! //! Tracing is built against the latest stable release. The minimum supported