logging: kill quiet option

no logging by default, enabled with -v

logging by default broke fstests

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2024-07-15 23:16:55 -04:00
parent e084e9f65b
commit 07913d1185
3 changed files with 8 additions and 19 deletions

View File

@ -152,10 +152,6 @@ pub struct Cli {
#[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())] #[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())]
colorize: bool, colorize: bool,
/// Quiet mode
#[arg(short, long)]
quiet: bool,
/// Verbose mode /// Verbose mode
#[arg(short, long, action = clap::ArgAction::Count)] #[arg(short, long, action = clap::ArgAction::Count)]
verbose: u8, verbose: u8,
@ -205,7 +201,7 @@ pub fn list(argv: Vec<String>) -> Result<()> {
let opt = Cli::parse_from(argv); let opt = Cli::parse_from(argv);
// TODO: centralize this on the top level CLI // TODO: centralize this on the top level CLI
logging::setup(opt.quiet, opt.verbose, opt.colorize); logging::setup(opt.verbose, opt.colorize);
cmd_list_inner(&opt) cmd_list_inner(&opt)
} }

View File

@ -250,10 +250,6 @@ pub struct Cli {
#[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())] #[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())]
colorize: bool, colorize: bool,
/// Quiet mode
#[arg(short, long)]
quiet: bool,
/// Verbose mode /// Verbose mode
#[arg(short, long, action = clap::ArgAction::Count)] #[arg(short, long, action = clap::ArgAction::Count)]
verbose: u8, verbose: u8,
@ -383,7 +379,7 @@ pub fn mount(mut argv: Vec<String>, symlink_cmd: Option<&str>) -> Result<()> {
let cli = Cli::parse_from(argv); let cli = Cli::parse_from(argv);
// TODO: centralize this on the top level CLI // TODO: centralize this on the top level CLI
logging::setup(cli.quiet, cli.verbose, cli.colorize); logging::setup(cli.verbose, cli.colorize);
cmd_mount_inner(&cli) cmd_mount_inner(&cli)
} }

View File

@ -1,15 +1,12 @@
use env_logger::WriteStyle; use env_logger::WriteStyle;
use log::LevelFilter; use log::LevelFilter;
pub fn setup(quiet: bool, verbose: u8, color: bool) { pub fn setup(verbose: u8, color: bool) {
let level_filter = if quiet { let level_filter = match verbose {
LevelFilter::Off 0 => LevelFilter::Off,
} else { 1 => LevelFilter::Info,
match verbose { 2 => LevelFilter::Debug,
0 => LevelFilter::Info,
1 => LevelFilter::Debug,
_ => LevelFilter::Trace, _ => LevelFilter::Trace,
}
}; };
let style = if color { let style = if color {