diff --git a/topiary-cli/Cargo.toml b/topiary-cli/Cargo.toml index 85a5d37a..470217c2 100644 --- a/topiary-cli/Cargo.toml +++ b/topiary-cli/Cargo.toml @@ -20,7 +20,7 @@ readme.workspace = true license.workspace = true [[bin]] -name = "topiary" +name = "topiary_cli" path = "src/main.rs" [dependencies] diff --git a/topiary-cli/src/cli.rs b/topiary-cli/src/cli.rs index 4df9ced5..e067d99c 100644 --- a/topiary-cli/src/cli.rs +++ b/topiary-cli/src/cli.rs @@ -184,15 +184,20 @@ pub fn get_args() -> CLIResult { let mut args = Cli::parse(); // This is the earliest point that we can initialise the logger, from the --verbose flags, - // before any fallible operations have started + // before any fallible operations have started. + // + // Be more strict with logs coming with the library; prefer to display less of them. + let (global_filter_level, library_filter_level) = match args.global.verbose { + 0 => (LevelFilter::Error, LevelFilter::Error), + 1 => (LevelFilter::Warn, LevelFilter::Warn), + 2 => (LevelFilter::Info, LevelFilter::Warn), + 3 => (LevelFilter::Debug, LevelFilter::Warn), + _ => (LevelFilter::Trace, LevelFilter::Trace), + }; + env_logger::Builder::new() - .filter_level(match args.global.verbose { - 0 => LevelFilter::Error, - 1 => LevelFilter::Warn, - 2 => LevelFilter::Info, - 3 => LevelFilter::Debug, - _ => LevelFilter::Trace, - }) + .filter_level(global_filter_level) + .filter_module("topiary", library_filter_level) .init(); // NOTE We do not check that input files are actual files (with Path::is_file), because that