Set up tracing-error

This commit is contained in:
Xiretza 2024-02-10 10:13:27 +00:00
parent ec9b0993bc
commit be0e778f80
3 changed files with 4 additions and 0 deletions

1
Cargo.lock generated
View file

@ -489,6 +489,7 @@ dependencies = [
"sqlx",
"tokio",
"tracing",
"tracing-error",
"tracing-subscriber",
]

View file

@ -21,4 +21,5 @@ secrecy = "0.8.0"
sqlx = { version = "0.7.3", features = ["runtime-tokio", "tls-rustls"] }
tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] }
tracing = "0.1.40"
tracing-error = "0.2.0"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

View file

@ -24,6 +24,7 @@ mod server;
use color_eyre::Result;
use tracing::{event, instrument, Level};
use tracing_error::ErrorLayer;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
#[instrument]
@ -38,6 +39,7 @@ fn init() -> Result<()> {
tracing_subscriber::registry()
.with(filter_layer)
.with(fmt_layer)
.with(ErrorLayer::default())
.init();
Ok(())