feat: Add request logging, supress noisy stuff from hyper
This commit is contained in:
parent
d1d12bdfb5
commit
fdba86ca60
3 changed files with 8 additions and 2 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -815,6 +815,7 @@ dependencies = [
|
|||
"tempfile",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tower-http",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"zip",
|
||||
|
@ -1133,6 +1134,7 @@ dependencies = [
|
|||
"tower",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -13,6 +13,7 @@ mime_guess = "2.0.4"
|
|||
tempfile = "3.3.0"
|
||||
tokio = { version = "1.19.2", features = ["full"] }
|
||||
tokio-util = { version = "0.7.3", features = ["io"] }
|
||||
tower-http = { version = "0.3.4", features = ["trace"] }
|
||||
tracing = "0.1.35"
|
||||
tracing-subscriber = { version = "0.3.14", features = ["env-filter"] }
|
||||
zip = "0.6.2"
|
||||
|
|
|
@ -3,6 +3,7 @@ use std::{fs, path::Path};
|
|||
use axum::Extension;
|
||||
use color_eyre::{eyre::eyre, Result};
|
||||
use projects::AuthToken;
|
||||
use tower_http::trace::TraceLayer;
|
||||
use tracing_subscriber::prelude::*;
|
||||
|
||||
mod projects;
|
||||
|
@ -14,7 +15,7 @@ async fn main() -> Result<()> {
|
|||
|
||||
tracing_subscriber::registry()
|
||||
.with(tracing_subscriber::filter::EnvFilter::new(
|
||||
std::env::var("RUST_LOG").unwrap_or_else(|_| "debug".into()),
|
||||
std::env::var("RUST_LOG").unwrap_or_else(|_| "debug,hyper=info".into()),
|
||||
))
|
||||
.with(tracing_subscriber::fmt::layer())
|
||||
.init();
|
||||
|
@ -32,7 +33,9 @@ async fn main() -> Result<()> {
|
|||
fs::create_dir_all(archive_dir)?;
|
||||
}
|
||||
|
||||
let app = routes::router().layer(Extension(AuthToken(upload_token)));
|
||||
let app = routes::router()
|
||||
.layer(Extension(AuthToken(upload_token)))
|
||||
.layer(TraceLayer::new_for_http());
|
||||
|
||||
let port: u16 = std::env::var("PORT")
|
||||
.map(|s| s.parse().unwrap())
|
||||
|
|
Loading…
Reference in a new issue