Add a logger (to stdout for the moment)
This commit is contained in:
parent
d64d0bceb8
commit
4971d7f0af
4 changed files with 139 additions and 146 deletions
|
|
@ -13,5 +13,6 @@ listenfd = "0.3" # To watch file modifications and automatically launch a build
|
|||
ron = "0.5" # Rust object notation, to load configuration files.
|
||||
itertools = "0.8"
|
||||
sqlite = "0.25"
|
||||
env_logger = "0.6"
|
||||
|
||||
common = { path = "../common" }
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
extern crate actix_web;
|
||||
extern crate listenfd;
|
||||
extern crate askama;
|
||||
|
||||
use listenfd::ListenFd;
|
||||
use actix_files as fs;
|
||||
use actix_web::{web, middleware, App, HttpServer, HttpResponse, Result, web::Query};
|
||||
use askama::Template;
|
||||
|
||||
use std::io::prelude::*;
|
||||
use std::{fs::File, env::args};
|
||||
|
||||
use actix_files as fs;
|
||||
use actix_web::{web, middleware, App, HttpServer, HttpResponse, Result, web::Query, middleware::Logger};
|
||||
|
||||
use askama::Template;
|
||||
use listenfd::ListenFd;
|
||||
use ron::de::from_reader;
|
||||
use serde::Deserialize;
|
||||
use std::{fs::File, env::args};
|
||||
use env_logger;
|
||||
|
||||
use itertools::Itertools;
|
||||
|
||||
|
|
@ -61,13 +59,17 @@ fn main() -> std::io::Result<()> {
|
|||
|
||||
println!("Configuration: {:?}", config);
|
||||
|
||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
||||
env_logger::init();
|
||||
|
||||
let mut listenfd = ListenFd::from_env();
|
||||
let mut server =
|
||||
HttpServer::new(
|
||||
|| {
|
||||
App::new()
|
||||
.wrap(middleware::Compress::default())
|
||||
.wrap(middleware::Logger::default())
|
||||
.wrap(Logger::default())
|
||||
.wrap(Logger::new("%a %{User-Agent}i"))
|
||||
.service(web::resource("/").to(main_page))
|
||||
.service(fs::Files::new("/static", "static").show_files_listing())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue