This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -1224,11 +1224,18 @@ pub fn install_ice_hook() {
12241224}
12251225
12261226/// This allows tools to enable rust logging without having to magically match rustc's
1227- /// log crate version
1227+ /// log crate version.
12281228pub fn init_rustc_env_logger ( ) {
1229+ init_env_logger ( "RUSTC_LOG" )
1230+ }
1231+
1232+ /// This allows tools to enable rust logging without having to magically match rustc's
1233+ /// log crate version. In contrast to `init_rustc_env_logger` it allows you to choose an env var
1234+ /// other than `RUSTC_LOG`.
1235+ pub fn init_env_logger ( env : & str ) {
12291236 let builder = tracing_subscriber:: FmtSubscriber :: builder ( ) ;
12301237
1231- let builder = builder. with_env_filter ( tracing_subscriber:: EnvFilter :: from_env ( "RUSTC_LOG" ) ) ;
1238+ let builder = builder. with_env_filter ( tracing_subscriber:: EnvFilter :: from_env ( env ) ) ;
12321239
12331240 builder. init ( )
12341241}
Original file line number Diff line number Diff line change 1414#![ feature( never_type) ]
1515#![ recursion_limit = "256" ]
1616
17- extern crate env_logger;
1817#[ macro_use]
1918extern crate lazy_static;
2019extern crate rustc_ast;
@@ -90,7 +89,8 @@ pub fn main() {
9089 } ;
9190 rustc_driver:: set_sigpipe_handler ( ) ;
9291 rustc_driver:: install_ice_hook ( ) ;
93- env_logger:: init_from_env ( "RUSTDOC_LOG" ) ;
92+ rustc_driver:: init_env_logger ( "RUSTDOC_LOG" ) ;
93+
9494 let res = std:: thread:: Builder :: new ( )
9595 . stack_size ( thread_stack_size)
9696 . spawn ( move || get_args ( ) . map ( |args| main_args ( & args) ) . unwrap_or ( 1 ) )
You can’t perform that action at this time.
0 commit comments