diff options
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/template/src/main.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cli/template/src/main.rs b/cli/template/src/main.rs index 9eb456f..cb5fa0e 100644 --- a/cli/template/src/main.rs +++ b/cli/template/src/main.rs @@ -57,6 +57,15 @@ fn main() -> Result<()> { fn init_logger(verbose: u8) { use std::io::Write; + if std::env::var_os("RUST_LOG").is_some() { + env_logger::builder() + .format(|buf, record| { + writeln!(buf, "[{}]: {}", record.level(), record.args()) + }) + .init(); + return; + } + let level = if verbose > 0 { LevelFilter::Debug } else { LevelFilter::Info }; |