log requests
This commit is contained in:
parent
c523993ba5
commit
07cd3b1ed4
3 changed files with 34 additions and 7 deletions
30
Cargo.lock
generated
30
Cargo.lock
generated
|
@ -1089,6 +1089,29 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca"
|
||||
|
||||
[[package]]
|
||||
name = "env_filter"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"env_filter",
|
||||
"humantime",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
|
@ -1117,6 +1140,7 @@ dependencies = [
|
|||
"chrono-tz",
|
||||
"comrak",
|
||||
"cyborgtime",
|
||||
"env_logger",
|
||||
"glob",
|
||||
"lol_html",
|
||||
"mime_guess",
|
||||
|
@ -1444,6 +1468,12 @@ version = "1.0.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "1.5.1"
|
||||
|
|
|
@ -33,6 +33,7 @@ urlencoding = "2.1"
|
|||
regex = "1.11"
|
||||
cyborgtime = "2.1.1"
|
||||
walkdir = "2.5"
|
||||
env_logger = "0.11"
|
||||
|
||||
[lints.clippy]
|
||||
pedantic = "warn"
|
||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -1,6 +1,6 @@
|
|||
use actix_files::Files;
|
||||
use actix_web::{
|
||||
middleware::{Compress, DefaultHeaders},
|
||||
middleware::{Compress, DefaultHeaders, Logger},
|
||||
web, App, HttpServer,
|
||||
};
|
||||
use std::io::Result;
|
||||
|
@ -29,16 +29,12 @@ async fn main() -> Result<()> {
|
|||
config.fc.port.unwrap(),
|
||||
);
|
||||
|
||||
println!(
|
||||
"Listening to {}://{}:{}",
|
||||
config.clone().fc.scheme.unwrap(),
|
||||
addr.0,
|
||||
addr.1
|
||||
);
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.app_data(web::Data::new(config.clone()))
|
||||
.wrap(Logger::default().log_target(config.fc.app_name.clone().unwrap_or_default()))
|
||||
.wrap(Compress::default())
|
||||
.wrap(
|
||||
DefaultHeaders::new()
|
||||
|
|
Loading…
Reference in a new issue