From 9c2d89e9818e36e648ed02bdf42bfd83884a6eff Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Thu, 15 May 2025 00:34:25 +0200 Subject: [PATCH] Remove NoLog variant from Log enum and update stdout logging methods --- backend/src/log.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/backend/src/log.rs b/backend/src/log.rs index 2c86ab0..720b2b2 100644 --- a/backend/src/log.rs +++ b/backend/src/log.rs @@ -35,7 +35,6 @@ pub enum Log { directory: PathBuf, }, StdoutOnly, - NoLog, } impl Log { @@ -86,8 +85,12 @@ impl Log { } pub fn new_to_stdout_only() -> Self { + Self::new_to_stdout_only_with_max_level(None) + } + + pub fn new_to_stdout_only_with_max_level(level: Option) -> Self { let layer_stdout = tracing_subscriber::fmt::layer() - .with_writer(std::io::stdout.with_max_level(TRACING_LEVEL)) + .with_writer(std::io::stdout.with_max_level(level.unwrap_or(TRACING_LEVEL))) .with_thread_ids(TRACING_DISPLAY_THREAD) .with_thread_names(TRACING_DISPLAY_THREAD); @@ -98,10 +101,6 @@ impl Log { Log::StdoutOnly } - pub fn new_no_log() -> Self { - Log::NoLog - } - pub fn file_names(&self) -> std::io::Result> { match self { Log::FileAndStdout { _guard, directory } => { @@ -130,7 +129,7 @@ impl Log { .rev() .collect()) } - Log::StdoutOnly | Log::NoLog => Ok(vec![]), + Log::StdoutOnly => Ok(vec![]), } } @@ -145,7 +144,7 @@ impl Log { .map(|l| l.unwrap_or_default()) .collect()) } - Log::StdoutOnly | Log::NoLog => Ok(vec![]), + Log::StdoutOnly => Ok(vec![]), } }