diff --git a/src/main.rs b/src/main.rs index 940ce0a..a54078e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ // // SPDX-License-Identifier: EUPL-1.1 +use std::env; use std::io::{self, IsTerminal}; use std::process::ExitCode; use std::{error::Error as StdError, sync::Arc}; @@ -12,6 +13,13 @@ use tracing_subscriber::util::SubscriberInitExt; use tracing_subscriber::{EnvFilter, layer::SubscriberExt}; fn main_wrapped() -> Result<(), Box> { + // Default RUST_LOG to warn if it's not specified. + if let None = env::var_os("RUST_LOG") { + unsafe { + env::set_var("RUST_LOG", "warn"); + } + } + let args = Arc::new(dynix::Args::parse()); let success = dynix::_CLI_ENABLE_COLOR.set(match args.color { @@ -47,6 +55,6 @@ fn main() -> ExitCode { Err(e) => { eprintln!("dynix: error: {}", e); ExitCode::FAILURE - } + }, } }