feat(logging): show debug logs in dev mode with russh::cipher hidden

This commit is contained in:
Erica Marigold 2025-08-14 19:22:43 +01:00
parent 6a3597002c
commit 403ff0f781
Signed by: DevComp
SSH key fingerprint: SHA256:jD3oMT4WL3WHPJQbrjC3l5feNCnkv7ndW8nYaHX5wFw

View file

@ -30,13 +30,21 @@ pub fn init() -> Result<()> {
// //
// Stage 1: Construct base filter // Stage 1: Construct base filter
let env_filter = EnvFilter::builder() let env_filter = EnvFilter::builder().with_default_directive(
.with_default_directive(tracing::Level::INFO.into()); if cfg!(debug_assertions) {
tracing::Level::DEBUG.into()
} else {
tracing::Level::INFO.into()
},
);
// Stage 2: Attempt to read from {RUST|CRATE_NAME}_LOG env var or ignore // Stage 2: Attempt to read from {RUST|CRATE_NAME}_LOG env var or ignore
let env_filter = env_filter.try_from_env().unwrap_or_else(|_| { let env_filter = env_filter
env_filter.with_env_var(LOG_ENV.to_string()).from_env_lossy() .try_from_env()
}); .unwrap_or_else(|_| {
env_filter.with_env_var(LOG_ENV.to_string()).from_env_lossy()
})
.add_directive("russh::cipher=info".parse().unwrap());
// Stage 3: Enable directives to reduce verbosity for release mode builds // Stage 3: Enable directives to reduce verbosity for release mode builds
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]