@@ -32,8 +32,6 @@ use cwdsource::*;
32
32
use filesource:: * ;
33
33
use varsource:: * ;
34
34
35
- use crate :: currentprocess;
36
-
37
35
/// An abstraction for the current process.
38
36
///
39
37
/// This acts as a clonable proxy to the global state provided by some key OS
@@ -138,16 +136,13 @@ pub fn with<F, R>(process: Process, f: F) -> R
138
136
where
139
137
F : FnOnce ( ) -> R ,
140
138
{
141
- use tracing_subscriber:: util:: SubscriberInitExt ;
142
-
143
139
ensure_hook ( ) ;
144
140
145
141
PROCESS . with ( |p| {
146
142
if let Some ( old_p) = & * p. borrow ( ) {
147
143
panic ! ( "current process already set {old_p:?}" ) ;
148
144
}
149
145
* p. borrow_mut ( ) = Some ( process) ;
150
- let _guard = tracing_subscriber ( ) . set_default ( ) ;
151
146
let result = f ( ) ;
152
147
* p. borrow_mut ( ) = None ;
153
148
result
@@ -164,35 +159,6 @@ fn ensure_hook() {
164
159
} ) ;
165
160
}
166
161
167
- fn tracing_subscriber ( ) -> impl tracing:: Subscriber {
168
- use tracing_subscriber:: {
169
- filter:: { EnvFilter , LevelFilter } ,
170
- layer:: SubscriberExt ,
171
- Layer , Registry ,
172
- } ;
173
-
174
- let curr_process = currentprocess:: process ( ) ;
175
- let maybe_directives = curr_process. var_os ( "RUST_LOG" ) . clone ( ) ;
176
- let logger = tracing_subscriber:: fmt:: layer ( )
177
- . with_writer ( move || curr_process. stderr ( ) )
178
- . with_ansi ( false ) ;
179
- let console_logger = if let Some ( directives) = maybe_directives {
180
- let env_filter = EnvFilter :: builder ( )
181
- . with_default_directive ( LevelFilter :: INFO . into ( ) )
182
- . parse_lossy ( directives. to_string_lossy ( ) ) ;
183
- logger. compact ( ) . with_filter ( env_filter) . boxed ( )
184
- } else {
185
- // Receive log lines from Rustup only.
186
- let env_filter = EnvFilter :: new ( "rustup=DEBUG" ) ;
187
- logger
188
- . event_format ( crate :: cli:: log:: EventFormatter )
189
- . with_filter ( env_filter)
190
- . boxed ( )
191
- } ;
192
- // TODO: What about the original otel logger?
193
- Registry :: default ( ) . with ( console_logger)
194
- }
195
-
196
162
/// Run a function in the context of a process definition and a tokio runtime.
197
163
///
198
164
/// The process state is injected into a thread-local in every work thread of
@@ -203,8 +169,6 @@ pub fn with_runtime<'a, R>(
203
169
mut runtime_builder : tokio:: runtime:: Builder ,
204
170
fut : impl Future < Output = R > + ' a ,
205
171
) -> R {
206
- use tracing:: instrument:: WithSubscriber ;
207
-
208
172
ensure_hook ( ) ;
209
173
210
174
let start_process = process. clone ( ) ;
@@ -251,7 +215,7 @@ pub fn with_runtime<'a, R>(
251
215
panic ! ( "current process already set {old_p:?}" ) ;
252
216
}
253
217
* p. borrow_mut ( ) = Some ( process) ;
254
- let result = runtime. block_on ( fut. with_subscriber ( tracing_subscriber ( ) ) ) ;
218
+ let result = runtime. block_on ( fut) ;
255
219
* p. borrow_mut ( ) = None ;
256
220
result
257
221
} )
0 commit comments