Skip to content

Commit 77f92eb

Browse files
jasonishopencode
andcommitted
Add quiet option to purge command
🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode <[email protected]>
1 parent e792b22 commit 77f92eb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/purge.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ pub struct PurgeArgs {
3232
/// Run purge every N minutes (for container deployments)
3333
#[clap(long, short)]
3434
interval: Option<u64>,
35+
36+
/// Only log warnings and errors
37+
#[clap(long, short)]
38+
quiet: bool,
3539
}
3640

3741
#[derive(Debug)]
@@ -42,7 +46,14 @@ struct FileInfo {
4246
}
4347

4448
pub fn purge_main(args: PurgeArgs) -> Result<()> {
49+
let log_level = if args.quiet {
50+
tracing::Level::WARN
51+
} else {
52+
tracing::Level::INFO
53+
};
54+
4555
tracing_subscriber::fmt()
56+
.with_max_level(log_level)
4657
.with_writer(std::io::stderr)
4758
.init();
4859

0 commit comments

Comments
 (0)