wip: drop the file and keep the early-init logging

This commit is contained in:
Cole Helbling 2024-04-23 08:29:03 -07:00
parent b983b25405
commit 3b1a1e3c12
2 changed files with 2 additions and 19 deletions

View file

@ -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);

View file

@ -447,7 +447,7 @@ async fn main() -> Result<()> {
}
}
fn init_logging() -> Result<tracing_appender::non_blocking::WorkerGuard> {
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<tracing_appender::non_blocking::WorkerGuard> {
.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)]