From 646f60d5675b32b13a013bbe135eee8d7a94fc6d Mon Sep 17 00:00:00 2001 From: Carlos V Date: Wed, 9 Oct 2024 17:11:48 +0000 Subject: [PATCH] feat: move init_tracing to a function outside main --- service/src/main.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/service/src/main.rs b/service/src/main.rs index c8ca2113..943e11eb 100644 --- a/service/src/main.rs +++ b/service/src/main.rs @@ -10,6 +10,15 @@ use tracing_subscriber::{EnvFilter, FmtSubscriber}; #[tokio::main] async fn main() -> ExitCode { + init_tracing(); + if let Err(e) = run().await { + tracing::error!("Indexer service error: {e}"); + return ExitCode::from(1); + } + ExitCode::SUCCESS +} + +fn init_tracing() { // Tracing setup let filter = EnvFilter::builder() .with_default_directive(LevelFilter::INFO.into()) @@ -23,10 +32,4 @@ async fn main() -> ExitCode { "Could not set up global default subscriber for logger, check \ environmental variable `RUST_LOG`", ); - - if let Err(e) = run().await { - tracing::error!("Indexer service error: {e}"); - return ExitCode::from(1); - } - ExitCode::SUCCESS }