[update] enhanced tracing-subscriber
setup with compact JSON logging and environment-based filter for streamlined production logging
This commit is contained in:
@@ -11,11 +11,15 @@ use axum::routing::get;
|
|||||||
use tokio::signal;
|
use tokio::signal;
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
use tracing_subscriber;
|
use tracing_subscriber;
|
||||||
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
tracing_subscriber::fmt()
|
tracing_subscriber::fmt()
|
||||||
.with_target(false)
|
.with_target(false)
|
||||||
|
.compact()
|
||||||
|
.with_env_filter(EnvFilter::from_default_env())
|
||||||
|
.json() // For Production
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
info!("Starting server");
|
info!("Starting server");
|
||||||
|
Reference in New Issue
Block a user