Initialize tracing_subscriber earlier
Browse files at this commit690d6355057ebeba03cbd8ce4905145b834c72f8Parent: a444efd1 changed file +7 -7
- src/main.rs +7 -7
src/main.rsmodified+7 -7
| @@ -48,6 +48,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { | |||
| 48 | REMOVE_ENV_RUST_LIB_BACKTRACE.store(true, Ordering::Relaxed); | 48 | REMOVE_ENV_RUST_LIB_BACKTRACE.store(true, Ordering::Relaxed); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | + let directives = env::var("RUST_LOG").unwrap_or_else(|_| DEFAULT_LOG_FILTER.to_owned()); | ||
| 52 | + let env_filter = EnvFilter::builder().parse_lossy(directives); | ||
| 53 | + tracing_subscriber::fmt() | ||
| 54 | + .compact() | ||
| 55 | + .with_env_filter(env_filter) | ||
| 56 | + .init(); | ||
| 57 | + | ||
| 51 | if env::var_os("NOTIFY_SOCKET").is_some() { | 58 | if env::var_os("NOTIFY_SOCKET").is_some() { |
| 52 | IS_SYSTEMD_SERVICE.store(true, Ordering::Relaxed); | 59 | IS_SYSTEMD_SERVICE.store(true, Ordering::Relaxed); |
| 53 | 60 | ||
| @@ -58,13 +65,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { | |||
| 58 | ); | 65 | ); |
| 59 | } | 66 | } |
| 60 | 67 | ||
| 61 | - let directives = env::var("RUST_LOG").unwrap_or_else(|_| DEFAULT_LOG_FILTER.to_owned()); | ||
| 62 | - let env_filter = EnvFilter::builder().parse_lossy(directives); | ||
| 63 | - tracing_subscriber::fmt() | ||
| 64 | - .compact() | ||
| 65 | - .with_env_filter(env_filter) | ||
| 66 | - .init(); | ||
| 67 | - | ||
| 68 | let cli = Cli::parse(); | 68 | let cli = Cli::parse(); |
| 69 | 69 | ||
| 70 | if cli.session { | 70 | if cli.session { |