Make rustdoc share the logger initialization routine with rustc.
This commit is contained in:
parent
64296ec698
commit
208f973d1f
@ -1224,11 +1224,18 @@ pub fn install_ice_hook() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// This allows tools to enable rust logging without having to magically match rustc's
|
/// This allows tools to enable rust logging without having to magically match rustc's
|
||||||
/// log crate version
|
/// log crate version.
|
||||||
pub fn init_rustc_env_logger() {
|
pub fn init_rustc_env_logger() {
|
||||||
|
init_env_logger("RUSTC_LOG")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This allows tools to enable rust logging without having to magically match rustc's
|
||||||
|
/// log crate version. In contrast to `init_rustc_env_logger` it allows you to choose an env var
|
||||||
|
/// other than `RUSTC_LOG`.
|
||||||
|
pub fn init_env_logger(env: &str) {
|
||||||
let builder = tracing_subscriber::FmtSubscriber::builder();
|
let builder = tracing_subscriber::FmtSubscriber::builder();
|
||||||
|
|
||||||
let builder = builder.with_env_filter(tracing_subscriber::EnvFilter::from_env("RUSTC_LOG"));
|
let builder = builder.with_env_filter(tracing_subscriber::EnvFilter::from_env(env));
|
||||||
|
|
||||||
builder.init()
|
builder.init()
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![recursion_limit = "256"]
|
#![recursion_limit = "256"]
|
||||||
|
|
||||||
extern crate env_logger;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
extern crate rustc_ast;
|
extern crate rustc_ast;
|
||||||
@ -90,7 +89,8 @@ pub fn main() {
|
|||||||
};
|
};
|
||||||
rustc_driver::set_sigpipe_handler();
|
rustc_driver::set_sigpipe_handler();
|
||||||
rustc_driver::install_ice_hook();
|
rustc_driver::install_ice_hook();
|
||||||
env_logger::init_from_env("RUSTDOC_LOG");
|
rustc_driver::init_env_logger("RUSTDOC_LOG");
|
||||||
|
|
||||||
let res = std::thread::Builder::new()
|
let res = std::thread::Builder::new()
|
||||||
.stack_size(thread_stack_size)
|
.stack_size(thread_stack_size)
|
||||||
.spawn(move || get_args().map(|args| main_args(&args)).unwrap_or(1))
|
.spawn(move || get_args().map(|args| main_args(&args)).unwrap_or(1))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user