feat: add verbose flag

This commit is contained in:
ThetaDev 2025-02-09 03:09:47 +01:00
parent e71e3d1197
commit 651c1e55b9
2 changed files with 13 additions and 7 deletions

View file

@ -139,8 +139,8 @@ Fetch a list of all the items saved in your YouTube/YouTube Music profile.
- **Proxy:** RustyPipe respects the environment variables `HTTP_PROXY`, `HTTPS_PROXY` - **Proxy:** RustyPipe respects the environment variables `HTTP_PROXY`, `HTTPS_PROXY`
and `ALL_PROXY` and `ALL_PROXY`
- **Logging:** You can change the log level with the `RUST_LOG` environment variable, it - **Logging:** Enable debug logging with the `-v` (verbose) flag. If you want more
is set to `info` by default fine-grained control, use the `RUST_LOG` environment variable.
- **Visitor data:** A custom visitor data ID can be used with the `--vdata` flag - **Visitor data:** A custom visitor data ID can be used with the `--vdata` flag
- **Authentication:** Use the commands `rustypipe login` and `rustypipe login --cookie` - **Authentication:** Use the commands `rustypipe login` and `rustypipe login --cookie`
to log into your Google account using either OAuth or YouTube cookies. With the to log into your Google account using either OAuth or YouTube cookies. With the

View file

@ -80,6 +80,9 @@ struct Cli {
/// Enable caching for session-bound PO tokens /// Enable caching for session-bound PO tokens
#[clap(long, global = true)] #[clap(long, global = true)]
pot_cache: bool, pot_cache: bool,
/// Enable debug logging
#[clap(short, long, global = true)]
verbose: bool,
} }
#[derive(Parser)] #[derive(Parser)]
@ -878,12 +881,15 @@ async fn run() -> anyhow::Result<()> {
let cli = Cli::parse(); let cli = Cli::parse();
let multi = MultiProgress::new(); let multi = MultiProgress::new();
let mut env_filter = EnvFilter::builder()
.with_default_directive(LevelFilter::INFO.into())
.from_env_lossy();
if cli.verbose {
env_filter = env_filter.add_directive("rustypipe=debug".parse().unwrap());
}
tracing_subscriber::fmt::SubscriberBuilder::default() tracing_subscriber::fmt::SubscriberBuilder::default()
.with_env_filter( .with_env_filter(env_filter)
EnvFilter::builder()
.with_default_directive(LevelFilter::INFO.into())
.from_env_lossy(),
)
.with_writer(ProgWriter(multi.clone())) .with_writer(ProgWriter(multi.clone()))
.init(); .init();