@@ -176,7 +176,7 @@ size_t parse_logging_spec(char* spec, log_directive* dirs) {
176
176
}
177
177
178
178
void update_module_map (const mod_entry* map, log_directive* dirs,
179
- size_t n_dirs, size_t *n_matches ) {
179
+ size_t n_dirs) {
180
180
for (const mod_entry* cur = map; cur->name ; cur++) {
181
181
size_t level = default_log_level, longest_match = 0 ;
182
182
for (size_t d = 0 ; d < n_dirs; d++) {
@@ -187,28 +187,18 @@ void update_module_map(const mod_entry* map, log_directive* dirs,
187
187
}
188
188
}
189
189
*cur->state = level;
190
- (*n_matches)++;
191
190
}
192
191
}
193
192
194
193
void update_crate_map (const cratemap* map, log_directive* dirs,
195
- size_t n_dirs, size_t *n_matches ) {
194
+ size_t n_dirs) {
196
195
// First update log levels for this crate
197
- update_module_map (map->entries , dirs, n_dirs, n_matches );
196
+ update_module_map (map->entries , dirs, n_dirs);
198
197
// Then recurse on linked crates
199
198
// FIXME this does double work in diamond-shaped deps. could keep
200
199
// a set of visited addresses, if it turns out to be actually slow
201
200
for (size_t i = 0 ; map->children [i]; i++) {
202
- update_crate_map (map->children [i], dirs, n_dirs, n_matches);
203
- }
204
- }
205
-
206
- void print_crate_log_map (const cratemap* map) {
207
- for (const mod_entry* cur = map->entries ; cur->name ; cur++) {
208
- printf (" %s\n " , cur->name );
209
- }
210
- for (size_t i = 0 ; map->children [i]; i++) {
211
- print_crate_log_map (map->children [i]);
201
+ update_crate_map (map->children [i], dirs, n_dirs);
212
202
}
213
203
}
214
204
@@ -228,61 +218,33 @@ size_t log_rt_kern;
228
218
size_t log_rt_backtrace;
229
219
230
220
static const mod_entry _rt_module_map[] =
231
- {{" :: rt::mem" , &log_rt_mem},
232
- {" :: rt::comm" , &log_rt_comm},
233
- {" :: rt::task" , &log_rt_task},
234
- {" :: rt::dom" , &log_rt_dom},
235
- {" :: rt::trace" , &log_rt_trace},
236
- {" :: rt::cache" , &log_rt_cache},
237
- {" :: rt::upcall" , &log_rt_upcall},
238
- {" :: rt::timer" , &log_rt_timer},
239
- {" :: rt::gc" , &log_rt_gc},
240
- {" :: rt::stdlib" , &log_rt_stdlib},
241
- {" :: rt::kern" , &log_rt_kern},
242
- {" :: rt::backtrace" , &log_rt_backtrace},
221
+ {{" rt::mem" , &log_rt_mem},
222
+ {" rt::comm" , &log_rt_comm},
223
+ {" rt::task" , &log_rt_task},
224
+ {" rt::dom" , &log_rt_dom},
225
+ {" rt::trace" , &log_rt_trace},
226
+ {" rt::cache" , &log_rt_cache},
227
+ {" rt::upcall" , &log_rt_upcall},
228
+ {" rt::timer" , &log_rt_timer},
229
+ {" rt::gc" , &log_rt_gc},
230
+ {" rt::stdlib" , &log_rt_stdlib},
231
+ {" rt::kern" , &log_rt_kern},
232
+ {" rt::backtrace" , &log_rt_backtrace},
243
233
{NULL , NULL }};
244
234
245
235
void update_log_settings (void * crate_map, char * settings) {
246
236
char * buffer = NULL ;
247
237
log_directive dirs[256 ];
248
238
size_t n_dirs = 0 ;
249
-
250
239
if (settings) {
251
-
252
- if (strcmp (settings, " ::help" ) == 0 ||
253
- strcmp (settings, " ?" ) == 0 ) {
254
- printf (" \n Crate log map:\n\n " );
255
- print_crate_log_map ((const cratemap*)crate_map);
256
- printf (" \n " );
257
- exit (1 );
258
- }
259
-
260
240
size_t buflen = strlen (settings) + 1 ;
261
241
buffer = (char *)malloc (buflen);
262
242
strncpy (buffer, settings, buflen);
263
243
n_dirs = parse_logging_spec (buffer, &dirs[0 ]);
264
244
}
265
245
266
- size_t n_matches = 0 ;
267
- update_module_map (_rt_module_map, &dirs[0 ], n_dirs, &n_matches);
268
- update_crate_map ((const cratemap*)crate_map, &dirs[0 ],
269
- n_dirs, &n_matches);
270
-
271
- if (n_matches < n_dirs) {
272
- printf (" warning: got %d RUST_LOG specs, enabled %d flags." ,
273
- n_dirs, n_matches);
274
- }
246
+ update_module_map (_rt_module_map, &dirs[0 ], n_dirs);
247
+ update_crate_map ((const cratemap*)crate_map, &dirs[0 ], n_dirs);
275
248
276
249
free (buffer);
277
250
}
278
-
279
- //
280
- // Local Variables:
281
- // mode: C++
282
- // fill-column: 78;
283
- // indent-tabs-mode: nil
284
- // c-basic-offset: 4
285
- // buffer-file-coding-system: utf-8-unix
286
- // compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
287
- // End:
288
- //
0 commit comments