From 4cda40b3cfc13fc655e8476fbba00a66ee41ddad Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin Date: Mon, 11 Dec 2023 19:08:31 +0000 Subject: [PATCH] Revert 1e523049ca8d076fa1757b8bb0a9851a61cdefae (#5731) --- bin/reth/src/cli/mod.rs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/bin/reth/src/cli/mod.rs b/bin/reth/src/cli/mod.rs index fb01aad765..1361b53d2d 100644 --- a/bin/reth/src/cli/mod.rs +++ b/bin/reth/src/cli/mod.rs @@ -232,27 +232,20 @@ impl Logs { { let mut layers = Vec::new(); - // Function to create a new EnvFilter with environment, default and additional directive - let create_env_filter = |additional_directive: &str| -> eyre::Result { - Ok(EnvFilter::builder() - .from_env_lossy() - .add_directive(DEFAULT_ENV_FILTER_DIRECTIVE.parse()?) - .add_directive(additional_directive.parse()?)) - }; - - // Create and add the journald layer if enabled if self.journald { - let journald_filter = create_env_filter(&self.journald_filter)?; layers.push( - reth_tracing::journald(journald_filter).expect("Could not connect to journald"), + reth_tracing::journald( + EnvFilter::try_new(DEFAULT_ENV_FILTER_DIRECTIVE)? + .add_directive(self.journald_filter.parse()?), + ) + .expect("Could not connect to journald"), ); } - // Create and add the file logging layer if enabled let file_guard = if self.log_file_max_files > 0 { - let file_filter = create_env_filter(&self.log_file_filter)?; let (layer, guard) = reth_tracing::file( - file_filter, + EnvFilter::try_new(DEFAULT_ENV_FILTER_DIRECTIVE)? + .add_directive(self.log_file_filter.parse()?), &self.log_file_directory, "reth.log", self.log_file_max_size * MB_TO_BYTES,