tracing output

This commit is contained in:
Alphonse Paix
2025-09-27 12:55:20 +02:00
parent f43e143bf6
commit 87c529ecb6
4 changed files with 3 additions and 61 deletions

View File

@@ -87,7 +87,7 @@ impl Application {
}
pub async fn run_until_stopped(self) -> Result<(), std::io::Error> {
tracing::debug!("Listening on {}", self.local_addr());
tracing::debug!("listening on {}", self.local_addr());
if let Some(tls_config) = self.tls_config {
axum_server::from_tcp_rustls(self.listener, tls_config)
.serve(self.router.into_make_service())
@@ -156,7 +156,6 @@ pub fn app(
method = ?request.method(),
matched_path,
request_id,
some_other_field = tracing::field::Empty,
)
}),
)

View File

@@ -1,12 +1,10 @@
use tokio::task::JoinHandle;
use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};
use tracing_subscriber::{fmt::MakeWriter, layer::SubscriberExt, util::SubscriberInitExt};
pub fn init_subscriber<Sink>(sink: Sink)
where
Sink: for<'a> MakeWriter<'a> + Send + Sync + 'static,
{
let formatting_layer = BunyanFormattingLayer::new(env!("CARGO_CRATE_NAME").into(), sink);
tracing_subscriber::registry()
.with(
tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| {
@@ -17,8 +15,7 @@ where
.into()
}),
)
.with(JsonStorageLayer)
.with(formatting_layer)
.with(tracing_subscriber::fmt::layer().pretty().with_writer(sink))
.init();
}