From 8dad453cc635f27fb5075a72df5b9e1ceaf49068 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 12 Aug 2025 14:37:09 +0100 Subject: [PATCH] fix(logging): not compiling in release mode due to conditional --- src/logging.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/logging.rs b/src/logging.rs index 5b243aa..34e74d2 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -2,7 +2,7 @@ use std::io::stderr; use color_eyre::{eyre::eyre, Result}; use tracing_error::ErrorLayer; -use tracing_subscriber::{fmt, prelude::*, EnvFilter, util::TryInitError}; +use tracing_subscriber::{fmt, prelude::*, util::TryInitError, EnvFilter}; use crate::config; @@ -52,6 +52,7 @@ pub fn init() -> Result<()> { // Build the subscriber and apply it tracing_subscriber::registry() .with(env_filter) + .with(ErrorLayer::default()) .with( // Logging to file fmt::layer() @@ -66,15 +67,19 @@ pub fn init() -> Result<()> { let layer = fmt::layer() .with_writer(stderr) .with_timer(tracing_subscriber::fmt::time()) + .with_thread_ids(true) .with_ansi(true); // Enable compact mode for release logs #[cfg(not(debug_assertions))] - return layer.compact(); - #[cfg(debug_assertions)] + let layer = layer + .compact() + .without_time() + .with_span_events(tracing_subscriber::fmt::format::FmtSpan::NONE) + .with_target(false) + .with_thread_ids(false); layer }) - .with(ErrorLayer::default()) .try_init() .map_err(|err: TryInitError| eyre!(err)) }