refactor(logging): enhance logging setup and usage

- Modified the `setup_logging` function to return a `Subscriber`, improving flexibility and reuse.
- Integrated `tracing::subscriber::set_global_default` in the main functions to establish the logging subscriber globally.
- Added configurations for span events and control over file and line information display.

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
This commit is contained in:
Harald Hoyer 2024-11-28 15:47:16 +01:00
parent 5b7f7482e6
commit f0fea5c122
Signed by: harald
GPG key ID: F519A1143B3FBE32
3 changed files with 25 additions and 10 deletions

View file

@ -110,7 +110,10 @@ struct Arguments {
async fn main() -> Result<()> {
let args = Arguments::parse();
setup_logging(&args.log_level)?;
tracing::subscriber::set_global_default(setup_logging(
env!("CARGO_CRATE_NAME"),
&args.log_level,
)?)?;
info!("Quote verified! Connection secure!");

View file

@ -26,7 +26,11 @@ use zksync_basic_types::L1BatchNumber;
#[tokio::main]
async fn main() -> Result<()> {
let args = Arguments::parse();
setup_logging(&args.log_level)?;
tracing::subscriber::set_global_default(setup_logging(
env!("CARGO_CRATE_NAME"),
&args.log_level,
)?)?;
validate_arguments(&args)?;
let (stop_sender, stop_receiver) = watch::channel(false);
let mut process_handle = tokio::spawn(verify_batches_proofs(stop_receiver, args));