main.rs: Add a flag for trace-level logs
This commit is contained in:
parent
7ce158ed1e
commit
31cde26138
|
@ -46,6 +46,9 @@ struct Args {
|
||||||
/// try doing a download test (to 127.0.0.1:9999)? Requires chutney.
|
/// try doing a download test (to 127.0.0.1:9999)? Requires chutney.
|
||||||
#[argh(switch)]
|
#[argh(switch)]
|
||||||
dl: bool,
|
dl: bool,
|
||||||
|
/// enable trace-level logging
|
||||||
|
#[argh(switch)]
|
||||||
|
trace: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Launch an authenticated channel to a relay.
|
/// Launch an authenticated channel to a relay.
|
||||||
|
@ -161,10 +164,15 @@ fn get_netdir(args: &Args) -> Result<tor_netdir::NetDir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
simple_logging::log_to_stderr(LevelFilter::Debug);
|
|
||||||
|
|
||||||
let args: Args = argh::from_env();
|
let args: Args = argh::from_env();
|
||||||
|
|
||||||
|
let filt = if args.trace {
|
||||||
|
LevelFilter::Trace
|
||||||
|
} else {
|
||||||
|
LevelFilter::Debug
|
||||||
|
};
|
||||||
|
simple_logging::log_to_stderr(filt);
|
||||||
|
|
||||||
if args.chutney_dir.is_none() && (args.flood || args.dl) {
|
if args.chutney_dir.is_none() && (args.flood || args.dl) {
|
||||||
eprintln!("--flood and --dl both require --chutney-dir.");
|
eprintln!("--flood and --dl both require --chutney-dir.");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|
Loading…
Reference in New Issue