cranelift: Move most debug-level logs to the trace level
Cranelift crates have historically been much more verbose with debug-level
logging than most other crates in the Rust ecosystem. We log things like how
many parameters a basic block has, the color of virtual registers during
regalloc, etc. Even for Cranelift hackers, these things are largely only useful
when hacking specifically on Cranelift and looking at a particular test case,
not even when using some Cranelift embedding (such as Wasmtime).
Most of the time, when people want logging for their Rust programs, they do
something like:
RUST_LOG=debug cargo run
This means that they get all that mostly not useful debug logging out of
Cranelift. So they might want to disable logging for Cranelift, or change it to
a higher log level:
RUST_LOG=debug,cranelift=info cargo run
The problem is that this is already more annoying to type that `RUST_LOG=debug`,
and that Cranelift isn't one single crate, so you actually have to play
whack-a-mole with naming all the Cranelift crates off the top of your head,
something more like this:
RUST_LOG=debug,cranelift=info,cranelift_codegen=info,cranelift_wasm=info,...
Therefore, we're changing most of the `debug!` logs into `trace!` logs: anything
that is very Cranelift-internal, unlikely to be useful/meaningful to the
"average" Cranelift embedder, or prints a message for each instruction visited
during a pass. On the other hand, things that just report a one line statistic
for a whole pass, for example, are left as `debug!`. The more verbose the log
messages are, the higher the bar they must clear to be `debug!` rather than
`trace!`.
This commit is contained in:
@@ -6,7 +6,6 @@ use crate::machinst::*;
|
||||
use crate::settings;
|
||||
use crate::timing;
|
||||
|
||||
use log::debug;
|
||||
use regalloc::{allocate_registers_with_opts, Algorithm, Options, PrettyPrint};
|
||||
|
||||
/// Compile the given function down to VCode with allocated registers, ready
|
||||
@@ -32,7 +31,7 @@ where
|
||||
|
||||
// Creating the vcode string representation may be costly for large functions, so defer its
|
||||
// rendering.
|
||||
debug!(
|
||||
log::trace!(
|
||||
"vcode from lowering: \n{}",
|
||||
DeferredDisplay::new(|| vcode.show_rru(Some(b.reg_universe())))
|
||||
);
|
||||
@@ -87,7 +86,7 @@ where
|
||||
},
|
||||
)
|
||||
.map_err(|err| {
|
||||
debug!(
|
||||
log::error!(
|
||||
"Register allocation error for vcode\n{}\nError: {:?}",
|
||||
vcode.show_rru(Some(b.reg_universe())),
|
||||
err
|
||||
@@ -104,7 +103,7 @@ where
|
||||
vcode.replace_insns_from_regalloc(result);
|
||||
}
|
||||
|
||||
debug!(
|
||||
log::trace!(
|
||||
"vcode after regalloc: final version:\n{}",
|
||||
DeferredDisplay::new(|| vcode.show_rru(Some(b.reg_universe())))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user