From b66023131bd66fd50a307d12c571fc23bc3037dc Mon Sep 17 00:00:00 2001 From: mrw1593 Date: Sun, 14 May 2023 10:43:23 -0400 Subject: Added logging support --- Cargo.lock | 1 + Cargo.toml | 1 + src/main.rs | 8 ++++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 582a115..e7c39aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1235,6 +1235,7 @@ dependencies = [ "dotenv", "exun", "hex", + "log", "raise", "rand", "rust-argon2", diff --git a/Cargo.toml b/Cargo.toml index 4366420..92eff53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,5 +15,6 @@ raise = "2" dotenv = "0.15" rand = "0.8" sqlx = { version = "0.6", features = [ "runtime-actix-rustls", "mysql", "uuid", "offline" ] } +log = "0.4" hex = "0.4" exun = "0.1" diff --git a/src/main.rs b/src/main.rs index 4b8762d..de3585b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,8 @@ -use actix_web::{web::Data, App, HttpServer}; -use exun::RawUnexpected; +use actix_web::middleware::Logger; +use actix_web::web::Data; +use actix_web::{App, HttpServer}; + +use exun::*; mod api; mod models; @@ -16,6 +19,7 @@ async fn main() -> Result<(), RawUnexpected> { // start the server HttpServer::new(move || { App::new() + .wrap(Logger::new("[%t] \"%r\" %s %Dms")) .app_data(Data::new(sql_pool.clone())) .service(api::liveops()) .service(api::users()) -- cgit v1.2.3