Skip to content

Commit d8e4d99

Browse files
authored
Rollup merge of #107839 - RalfJung:rustc-log, r=oli-obk
avoid duplicating the RUSTC_LOG env var name We also have the env var name here: https://github.com/rust-lang/rust/blob/c40919b7a75f93ed7ef040361e82c656d246d41e/compiler/rustc_driver_impl/src/lib.rs#L1247-L1251 Redundantly having this name twice doesn't seem great. Looks like `rustc_log::init_rustc_env_logger` is dead code anyway. r? `@oli-obk`
2 parents d494cd3 + 623ed8e commit d8e4d99

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

compiler/rustc_log/src/lib.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//!
1515
//! ```
1616
//! fn main() {
17-
//! rustc_log::init_rustc_env_logger().unwrap();
17+
//! rustc_log::init_env_logger("LOG").unwrap();
1818
//!
1919
//! let edition = rustc_span::edition::Edition::Edition2021;
2020
//! rustc_span::create_session_globals_then(edition, || {
@@ -23,9 +23,9 @@
2323
//! }
2424
//! ```
2525
//!
26-
//! Now `RUSTC_LOG=debug cargo run` will run your minimal main.rs and show
26+
//! Now `LOG=debug cargo run` will run your minimal main.rs and show
2727
//! rustc's debug logging. In a workflow like this, one might also add
28-
//! `std::env::set_var("RUSTC_LOG", "debug")` to the top of main so that `cargo
28+
//! `std::env::set_var("LOG", "debug")` to the top of main so that `cargo
2929
//! run` by itself is sufficient to get logs.
3030
//!
3131
//! The reason rustc_log is a tiny separate crate, as opposed to exposing the
@@ -53,12 +53,6 @@ use tracing_subscriber::fmt::{
5353
};
5454
use tracing_subscriber::layer::SubscriberExt;
5555

56-
pub fn init_rustc_env_logger() -> Result<(), Error> {
57-
init_env_logger("RUSTC_LOG")
58-
}
59-
60-
/// In contrast to `init_rustc_env_logger` this allows you to choose an env var
61-
/// other than `RUSTC_LOG`.
6256
pub fn init_env_logger(env: &str) -> Result<(), Error> {
6357
let filter = match env::var(env) {
6458
Ok(env) => EnvFilter::new(env),

0 commit comments

Comments
 (0)