From 4d625951b823f7365dcaeb4e5c8f15263af43eb0 Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Mon, 19 Feb 2024 07:17:58 +0200 Subject: [PATCH] Deprecate env_log flag in tracing layer (#5228) * deprecate terminal logs file in tracing layer * sink writer --- common/logging/src/lib.rs | 8 ++------ lighthouse/src/main.rs | 4 +--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/common/logging/src/lib.rs b/common/logging/src/lib.rs index caf3e1d2f..3a5a5209b 100644 --- a/common/logging/src/lib.rs +++ b/common/logging/src/lib.rs @@ -223,7 +223,7 @@ impl TimeLatch { } } -pub fn create_tracing_layer(base_tracing_log_path: PathBuf, turn_on_terminal_logs: bool) { +pub fn create_tracing_layer(base_tracing_log_path: PathBuf) { let filter_layer = match tracing_subscriber::EnvFilter::try_from_default_env() .or_else(|_| tracing_subscriber::EnvFilter::try_new("warn")) { @@ -268,11 +268,7 @@ pub fn create_tracing_layer(base_tracing_log_path: PathBuf, turn_on_terminal_log if let Err(e) = tracing_subscriber::fmt() .with_env_filter(filter_layer) - .with_writer(move || { - tracing_subscriber::fmt::writer::OptionalWriter::::from( - turn_on_terminal_logs.then(std::io::stdout), - ) - }) + .with_writer(std::io::sink) .finish() .with(MetricsLayer) .with(custom_layer) diff --git a/lighthouse/src/main.rs b/lighthouse/src/main.rs index 022b20835..d646b9764 100644 --- a/lighthouse/src/main.rs +++ b/lighthouse/src/main.rs @@ -556,9 +556,7 @@ fn run( let path = tracing_log_path.clone().unwrap(); - let turn_on_terminal_logs = matches.is_present("env_log"); - - logging::create_tracing_layer(path, turn_on_terminal_logs); + logging::create_tracing_layer(path); // Allow Prometheus to export the time at which the process was started. metrics::expose_process_start_time(&log);