Skip to content

Commit

Permalink
feat: move init_tracing to a function outside main
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosvdr committed Oct 9, 2024
1 parent 3dd8a03 commit 646f60d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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
}

0 comments on commit 646f60d

Please sign in to comment.