diff --git a/server/Cargo.toml b/server/Cargo.toml index 3af27a3..739f70f 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -6,12 +6,13 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -axum = "0.6.18" +axum = { version = "0.6.18", features = ["http2"] } futures = "0.3.28" libarchive = { path = "../libarchive" } sha256 = "1.1.4" tokio = { version = "1.29.1", features = ["full"] } tokio-util = { version = "0.7.8", features = ["io"] } tower = { version = "0.4.13", features = ["make"] } -tower-http = { version = "0.4.1", features = ["fs"] } +tower-http = { version = "0.4.1", features = ["fs", "trace"] } +tracing-subscriber = "0.3.17" uuid = { version = "1.4.0", features = ["v4"] } diff --git a/server/src/main.rs b/server/src/main.rs index de80e2f..7e7b833 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -8,6 +8,7 @@ use axum::Router; use repo::RepoGroupManager; use std::path::PathBuf; use std::sync::{Arc, RwLock}; +use tower_http::trace::TraceLayer; #[derive(Clone)] pub struct Config { @@ -42,10 +43,13 @@ async fn main() { repo_manager: Arc::new(RwLock::new(repo_manager)), }; + tracing_subscriber::fmt::init(); + // build our application with a single route let app = Router::new() .merge(repo::router(&global)) - .with_state(global); + .with_state(global) + .layer(TraceLayer::new_for_http()); // run it with hyper on localhost:3000 axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())