Skip to content

Commit 016009a

Browse files
committed
properly recognize log levels
1 parent 5397f2e commit 016009a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/bin/miri.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ extern crate syntax;
1313
extern crate log;
1414

1515
use std::path::PathBuf;
16+
use std::str::FromStr;
1617
use std::env;
1718

1819
use rustc::session::Session;
@@ -172,15 +173,14 @@ fn init_late_loggers() {
172173
if env::var("RUST_LOG").is_err() {
173174
// We try to be a bit clever here: If MIRI_LOG is just a single level
174175
// used for everything, we only apply it to the parts of rustc that are
175-
// CTFE-related. Only if MIRI_LOG contains `module=level`, we just
176-
// use the same value for RUST_LOG.
176+
// CTFE-related. Otherwise, we use it verbatim for RUST_LOG.
177177
// This way, if you set `MIRI_LOG=trace`, you get only the right parts of
178178
// rustc traced, but you can also do `MIRI_LOG=miri=trace,rustc_mir::interpret=debug`.
179-
if var.contains('=') {
180-
env::set_var("RUST_LOG", &var);
181-
} else {
179+
if log::Level::from_str(&var).is_ok() {
182180
env::set_var("RUST_LOG",
183181
&format!("rustc::mir::interpret={0},rustc_mir::interpret={0}", var));
182+
} else {
183+
env::set_var("RUST_LOG", &var);
184184
}
185185
rustc_driver::init_rustc_env_logger();
186186
}

0 commit comments

Comments
 (0)