clif-util: always use pretty-env-logger (#4443)

Rather than sometimes using `file-per-thread-logger`.

Also remove the debug CLI flags, so that we can always just define
`RUST_LOG=...` to get logging and don't need to also do other things.
This commit is contained in:
Nick Fitzgerald
2022-07-13 13:43:12 -07:00
committed by GitHub
parent 4ea46c3ca8
commit f7767eb352
9 changed files with 2 additions and 54 deletions

View File

@@ -13,7 +13,6 @@
)]
use clap::Parser;
use cranelift_codegen::dbg::LOG_FILENAME_PREFIX;
use std::path::PathBuf;
mod bugpoint;
@@ -31,14 +30,6 @@ mod souper_harvest;
#[cfg(feature = "wasm")]
mod wasm;
fn handle_debug_flag(debug: bool) {
if debug {
pretty_env_logger::init();
} else {
file_per_thread_logger::initialize(LOG_FILENAME_PREFIX);
}
}
/// Cranelift code generator utility.
#[derive(Parser)]
enum Commands {
@@ -73,10 +64,6 @@ struct TestOptions {
#[clap(short = 'T')]
time_passes: bool,
/// Enable debug output on stderr/stdout
#[clap(short = 'd')]
debug: bool,
/// Specify an input file to be used. Use '-' for stdin.
#[clap(required = true)]
files: Vec<PathBuf>,
@@ -93,10 +80,6 @@ struct PassOptions {
#[clap(short = 'T')]
time_passes: bool,
/// Enable debug output on stderr/stdout
#[clap(short)]
debug: bool,
/// Specify an input file to be used. Use '-' for stdin.
file: PathBuf,
@@ -113,6 +96,8 @@ struct PassOptions {
struct CompiledWithoutSupportOptions {}
fn main() -> anyhow::Result<()> {
pretty_env_logger::init();
match Commands::parse() {
Commands::Cat(c) => cat::run(&c)?,
Commands::Run(r) => run::run(&r)?,
@@ -135,7 +120,6 @@ fn main() -> anyhow::Result<()> {
),
Commands::Test(t) => {
handle_debug_flag(t.debug);
cranelift_filetests::run(
t.verbose,
t.time_passes,
@@ -146,7 +130,6 @@ fn main() -> anyhow::Result<()> {
)?;
}
Commands::Pass(p) => {
handle_debug_flag(p.debug);
cranelift_filetests::run_passes(
p.verbose,
p.time_passes,