From 964c083ea1a862f47f20228f64918da6ce8f30cd Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sun, 6 Aug 2023 21:02:47 +0100 Subject: [PATCH] doc(logging): update mentions of `log` to `tracing` --- src/doc/contrib/src/implementation/debugging.md | 15 ++++++++------- src/doc/src/reference/environment-variables.md | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/doc/contrib/src/implementation/debugging.md b/src/doc/contrib/src/implementation/debugging.md index e148d72c36b..03940e2ffe1 100644 --- a/src/doc/contrib/src/implementation/debugging.md +++ b/src/doc/contrib/src/implementation/debugging.md @@ -2,11 +2,11 @@ ## Logging -Cargo uses the [`env_logger`] crate to display debug log messages. The -`CARGO_LOG` environment variable can be set to enable debug logging, with a -value such as `trace`, `debug`, or `warn`. It also supports filtering for -specific modules. Feel free to use the standard [`log`] macros to help with -diagnosing problems. +Cargo uses the [`tracing`] crate to display debug log messages. +The `CARGO_LOG` environment variable can be set to enable debug logging, with a value such as `trace`, `debug`, or `warn`. +It also supports filtering for specific modules with comma-separated [directives]. +Feel free to use [shorthand macros] to help with diagnosing problems. +We're looking forward to making Cargo logging mechanism more structural! ```sh # Outputs all logs with levels debug and higher @@ -22,5 +22,6 @@ CARGO_HTTP_DEBUG=true CARGO_LOG=cargo::ops::registry=debug cargo fetch CARGO_LOG=cargo::core::compiler::fingerprint=trace cargo build ``` -[`env_logger`]: https://docs.rs/env_logger -[`log`]: https://docs.rs/log +[`tracing`]: https://docs.rs/tracing +[directive]: https://docs.rs/tracing_subscriber/filter/struct.EnvFilter.html#directives +[shorthand macros]: https://docs.rs/tracing/index.html#shorthand-macros diff --git a/src/doc/src/reference/environment-variables.md b/src/doc/src/reference/environment-variables.md index ab0562cc1fe..25881d1388d 100644 --- a/src/doc/src/reference/environment-variables.md +++ b/src/doc/src/reference/environment-variables.md @@ -9,7 +9,7 @@ with them: You can override these environment variables to change Cargo's behavior on your system: -* `CARGO_LOG` --- Cargo uses the [`env_logger`] crate to display debug log messages. +* `CARGO_LOG` --- Cargo uses the [`tracing`] crate to display debug log messages. The `CARGO_LOG` environment variable can be set to enable debug logging, with a value such as `trace`, `debug`, or `warn`. Usually it is only used during debugging. For more details refer to the @@ -389,7 +389,7 @@ let out_dir = env::var("OUT_DIR").unwrap(); the environment; scripts should use `CARGO_ENCODED_RUSTFLAGS` instead. * `CARGO_PKG_` --- The package information variables, with the same names and values as are [provided during crate building][variables set for crates]. -[`env_logger`]: https://docs.rs/env_logger +[`tracing`]: https://docs.rs/tracing [debug logging]: https://doc.crates.io/contrib/architecture/console.html#debug-logging [unix-like platforms]: ../../reference/conditional-compilation.html#unix-and-windows [windows-like platforms]: ../../reference/conditional-compilation.html#unix-and-windows