Skip to content

Commit

Permalink
Initialize tracing_subscriber earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
notpeelz authored and YaLTeR committed Feb 5, 2025
1 parent a444efd commit 690d635
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
REMOVE_ENV_RUST_LIB_BACKTRACE.store(true, Ordering::Relaxed);
}

let directives = env::var("RUST_LOG").unwrap_or_else(|_| DEFAULT_LOG_FILTER.to_owned());
let env_filter = EnvFilter::builder().parse_lossy(directives);
tracing_subscriber::fmt()
.compact()
.with_env_filter(env_filter)
.init();

if env::var_os("NOTIFY_SOCKET").is_some() {
IS_SYSTEMD_SERVICE.store(true, Ordering::Relaxed);

Expand All @@ -58,13 +65,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
);
}

let directives = env::var("RUST_LOG").unwrap_or_else(|_| DEFAULT_LOG_FILTER.to_owned());
let env_filter = EnvFilter::builder().parse_lossy(directives);
tracing_subscriber::fmt()
.compact()
.with_env_filter(env_filter)
.init();

let cli = Cli::parse();

if cli.session {
Expand Down

0 comments on commit 690d635

Please sign in to comment.