From f816b1034bab7d19c39a242b56094eb3f8def38c Mon Sep 17 00:00:00 2001 From: Radu Marias Date: Thu, 1 Aug 2024 00:00:11 +0300 Subject: [PATCH] include debug level in release builds --- Cargo.toml | 2 +- src/lib.rs | 4 +--- src/main.rs | 3 +++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5d9a35d..f5677a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ tokio = { version = "1.36", features = ["full"] } tokio-stream = { version = "0.1.15", features = ["fs"] } futures-util = "0.3.30" bytes = "1.5" -tracing = { version = "0.1.40", features = ["max_level_trace", "release_max_level_info"] } +tracing = { version = "0.1.40", features = ["max_level_trace", "release_max_level_debug"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-appender = "0.2.3" tracing-test = "0.2.4" diff --git a/src/lib.rs b/src/lib.rs index 9397ed7..0abffcf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -316,8 +316,6 @@ pub static GID: LazyLock = LazyLock::new(|| unsafe { libc::getgid() }); #[must_use] pub const fn is_debug() -> bool { #[cfg(debug_assertions)] - { - return true; - } + true; false } diff --git a/src/main.rs b/src/main.rs index 30a83ed..1746faf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -474,6 +474,9 @@ fn umount(mountpoint: &str) -> io::Result<()> { #[allow(clippy::missing_panics_doc)] pub fn log_init(level: Level) -> WorkerGuard { + // Set the RUST_LOG environment variable to include debug logs + env::set_var("RUST_LOG", "debug"); + let directive = format!("rencfs={}", level.as_str()) .parse() .expect("cannot parse log directive");