Use pretty logging at high -vvvv

This commit is contained in:
Félix Saparelli 2022-01-15 15:14:25 +13:00
parent 2c840f4a2d
commit 00def9e19a
No known key found for this signature in database
GPG key ID: B948C4BAE44FC474
4 changed files with 18 additions and 8 deletions

View file

@ -85,7 +85,7 @@ pub fn get_args(tagged_filterer: bool) -> Result<ArgMatches<'static>> {
.long("debounce"))
.arg(Arg::with_name("verbose")
.help_heading(Some(OPTSET_DEBUGGING))
.help("Print debugging messages (-v, -vv, -vvv; use -vvv for bug reports)")
.help("Print debugging messages (-v, -vv, -vvv, -vvvv; use -vvv for bug reports)")
.multiple(true)
.short("v")
.long("verbose"))

View file

@ -26,15 +26,25 @@ async fn main() -> Result<()> {
let args = args::get_args(tagged_filterer)?;
tracing_subscriber::fmt()
.with_env_filter(match args.occurrences_of("verbose") {
{
let verbosity = args.occurrences_of("verbose");
let mut builder = tracing_subscriber::fmt().with_env_filter(match verbosity {
0 => "watchexec-cli=warn",
1 => "watchexec=debug,watchexec-cli=debug",
2 => "watchexec=trace,watchexec-cli=trace",
_ => "trace",
})
.try_init()
.ok();
});
if verbosity > 2 {
builder = builder.with_span_events(tracing_subscriber::fmt::format::FmtSpan::FULL);
}
if verbosity > 3 {
builder.pretty().try_init().ok();
} else {
builder.try_init().ok();
}
}
let init = config::init(&args)?;
let mut runtime = config::runtime(&args)?;

View file

@ -25,7 +25,7 @@ FLAGS:
--print-events Print events that trigger actions
-r, --restart Restart the process if it's still running. Shorthand for --on-busy-update=restart
-V, --version Prints version information
-v, --verbose Print debugging messages (-v, -vv, -vvv; use -vvv for bug reports)
-v, --verbose Print debugging messages (-v, -vv, -vvv, -vvvv; use -vvv for bug reports)
OPTIONS:
-d, --debounce <milliseconds> Set the timeout between detected change and command execution, defaults to

View file

@ -25,7 +25,7 @@ FLAGS:
--print-events Print events that trigger actions
-r, --restart Restart the process if it's still running. Shorthand for --on-busy-update=restart
-V, --version Prints version information
-v, --verbose Print debugging messages (-v, -vv, -vvv; use -vvv for bug reports)
-v, --verbose Print debugging messages (-v, -vv, -vvv, -vvvv; use -vvv for bug reports)
OPTIONS:
-d, --debounce <milliseconds> Set the timeout between detected change and command execution, defaults to