add basic logging

This commit is contained in:
xenofem 2022-04-16 00:03:09 -04:00
parent 69e44b9cbe
commit 7a3fd3f2ca
4 changed files with 54 additions and 1 deletions

View file

@ -1,6 +1,9 @@
use std::{sync::Arc, time::Duration};
use actix_web::{get, http::header::ContentType, web, App, HttpResponse, HttpServer, Responder};
use actix_web::{
get, http::header::ContentType, middleware::Logger, web, App, HttpResponse, HttpServer,
Responder,
};
use lazy_static::lazy_static;
use tokio::sync::RwLock;
@ -60,11 +63,14 @@ async fn start_updater() -> Result<web::Data<AppState>, Error> {
#[actix_web::main]
async fn main() -> std::io::Result<()> {
simple_logger::init_with_level(log::Level::Info).unwrap();
let state = start_updater().await.expect("Failed to initialize state");
HttpServer::new(move || {
App::new()
.app_data(state.clone())
.wrap(Logger::default())
.service(csv)
.service(json)
.service(actix_files::Files::new("/", "./static/").index_file("index.html"))