From 3b1a1e3c12d203497accd7caf6be80a32effd95e Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Tue, 23 Apr 2024 08:29:03 -0700 Subject: [PATCH] wip: drop the file and keep the early-init logging --- magic-nix-cache/src/api.rs | 6 ------ magic-nix-cache/src/main.rs | 15 ++------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/magic-nix-cache/src/api.rs b/magic-nix-cache/src/api.rs index e8d8919..ae643bd 100644 --- a/magic-nix-cache/src/api.rs +++ b/magic-nix-cache/src/api.rs @@ -57,12 +57,6 @@ async fn workflow_finish( } } - // NOTE(cole-h): see `init_logging` - let logfile = std::env::temp_dir().join("magic-nix-cache-tracing.log"); - let logfile_contents = std::fs::read_to_string(logfile)?; - println!("Every log line throughout the lifetime of the program:"); - println!("\n{logfile_contents}\n"); - let reply = WorkflowFinishResponse {}; //state.metrics.num_new_paths.set(num_new_paths); diff --git a/magic-nix-cache/src/main.rs b/magic-nix-cache/src/main.rs index f735ad0..31cee73 100644 --- a/magic-nix-cache/src/main.rs +++ b/magic-nix-cache/src/main.rs @@ -447,7 +447,7 @@ async fn main() -> Result<()> { } } -fn init_logging() -> Result { +fn init_logging() -> Result<()> { let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| { #[cfg(debug_assertions)] return EnvFilter::new("info") @@ -462,23 +462,12 @@ fn init_logging() -> Result { .with_writer(std::io::stderr) .pretty(); - let logfile = std::env::temp_dir().join("magic-nix-cache-tracing.log"); - let file = std::fs::OpenOptions::new() - .create(true) - .append(true) - .open(logfile)?; - let (nonblocking, guard) = tracing_appender::non_blocking(file); - let file_layer = tracing_subscriber::fmt::layer() - .with_writer(nonblocking) - .pretty(); - tracing_subscriber::registry() .with(filter) .with(stderr_layer) - .with(file_layer) .init(); - Ok(guard) + Ok(()) } #[cfg(debug_assertions)]