Skip to content

Commit

Permalink
doc(logging): update mentions of log to tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Aug 7, 2023
1 parent 9d707e4 commit 964c083
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions src/doc/contrib/src/implementation/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions src/doc/src/reference/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -389,7 +389,7 @@ let out_dir = env::var("OUT_DIR").unwrap();
the environment; scripts should use `CARGO_ENCODED_RUSTFLAGS` instead.
* `CARGO_PKG_<var>` --- 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
Expand Down

0 comments on commit 964c083

Please sign in to comment.