diff --git a/CHANGELOG.md b/CHANGELOG.md index b96b3e2..106f388 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Display the total cleaned amount when sweeping multiple projects [#45](https://github.com/holmgr/cargo-sweep/pull/45) - No longer give a hard error when a custom toolchain gives an error [#67](https://github.com/holmgr/cargo-sweep/pull/67) - Don't print colors when stdout is not a terminal [#69](https://github.com/holmgr/cargo-sweep/pull/69) - Add long `--verbose` and `--recursive` flags [#73](https://github.com/holmgr/cargo-sweep/pull/73) @@ -17,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Refactor and add `-m` as a short flag for `--maxsize` [#87](https://github.com/holmgr/cargo-sweep/pull/87) - Only show toolchain list once when using `--installed` [#88](https://github.com/holmgr/cargo-sweep/pull/88) - Support multiple projects as input via CLI [#101](https://github.com/holmgr/cargo-sweep/pull/101) +- Add a `TRACE` log level enabled by two `--verbose` flags [#113](https://github.com/holmgr/cargo-sweep/pull/113) ### Fixed @@ -24,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Kibibytes are now printed as `KiB`, not `kiB` [#69](https://github.com/holmgr/cargo-sweep/pull/69) - Exit with non-zero status on failure [#72](https://github.com/holmgr/cargo-sweep/pull/72) - Keep stamp file on dry run [#100](https://github.com/holmgr/cargo-sweep/pull/100) +- Fix invisible output in white-themed terminals [#103](https://github.com/holmgr/cargo-sweep/pull/103) ## **0.6.2** and prior diff --git a/src/cli.rs b/src/cli.rs index 4908650..f6538da 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -82,9 +82,9 @@ pub struct Args { #[arg(long, value_delimiter = ',')] toolchains: Vec, - /// Turn verbose information on - #[arg(short, long)] - pub verbose: bool, + /// Enable DEBUG logs (use twice for TRACE logs) + #[arg(short, long, action = clap::ArgAction::Count)] + pub verbose: u8, } impl Args { diff --git a/src/fingerprint.rs b/src/fingerprint.rs index 026ac27..0cdcf4f 100644 --- a/src/fingerprint.rs +++ b/src/fingerprint.rs @@ -1,5 +1,6 @@ #![allow(deprecated)] use anyhow::{bail, Context, Error}; +use log::trace; use log::{debug, info, warn}; use serde_derive::Deserialize; use serde_json::from_str; @@ -94,7 +95,7 @@ fn load_all_fingerprints_built_with( } } } - debug!("Hashs to keep: {:#?}", keep); + trace!("Hashs to keep: {:#?}", keep); Ok(keep) } @@ -156,7 +157,7 @@ fn load_all_fingerprints_newer_than( } } } - debug!("Hashs to keep: {:#?}", keep); + trace!("Hashs to keep: {:#?}", keep); Ok(keep) } diff --git a/src/main.rs b/src/main.rs index 0d3f45b..20c1d8f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,11 +25,11 @@ use self::stamp::Timestamp; use self::util::format_bytes; /// Setup logging according to verbose flag. -fn setup_logging(verbose: bool) { - let level = if verbose { - log::LevelFilter::Debug - } else { - log::LevelFilter::Info +fn setup_logging(verbosity_level: u8) { + let level = match verbosity_level { + 0 => log::LevelFilter::Info, + 1 => log::LevelFilter::Debug, + 2.. => log::LevelFilter::Trace, }; let isatty = std::io::stdout().is_tty(); diff --git a/tests/usage.trycmd b/tests/usage.trycmd index 00fdbb6..e2a0bf8 100644 --- a/tests/usage.trycmd +++ b/tests/usage.trycmd @@ -17,7 +17,7 @@ Options: -s, --stamp Store timestamp file at the given path, is used by file option -t, --time Number of days backwards to keep --toolchains Toolchains currently installed by rustup that should have their artifacts kept - -v, --verbose Turn verbose information on + -v, --verbose... Enable DEBUG logs (use twice for TRACE logs) -h, --help Print help (see more with '--help') -V, --version Print version