File tree 2 files changed +11
-4
lines changed
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() {
1224
1224
}
1225
1225
1226
1226
/// This allows tools to enable rust logging without having to magically match rustc's
1227
- /// log crate version
1227
+ /// log crate version.
1228
1228
pub 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 ) {
1229
1236
let builder = tracing_subscriber:: FmtSubscriber :: builder ( ) ;
1230
1237
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 ) ) ;
1232
1239
1233
1240
builder. init ( )
1234
1241
}
Original file line number Diff line number Diff line change 14
14
#![ feature( never_type) ]
15
15
#![ recursion_limit = "256" ]
16
16
17
- extern crate env_logger;
18
17
#[ macro_use]
19
18
extern crate lazy_static;
20
19
extern crate rustc_ast;
@@ -90,7 +89,8 @@ pub fn main() {
90
89
} ;
91
90
rustc_driver:: set_sigpipe_handler ( ) ;
92
91
rustc_driver:: install_ice_hook ( ) ;
93
- env_logger:: init_from_env ( "RUSTDOC_LOG" ) ;
92
+ rustc_driver:: init_env_logger ( "RUSTDOC_LOG" ) ;
93
+
94
94
let res = std:: thread:: Builder :: new ( )
95
95
. stack_size ( thread_stack_size)
96
96
. spawn ( move || get_args ( ) . map ( |args| main_args ( & args) ) . unwrap_or ( 1 ) )
You can’t perform that action at this time.
0 commit comments