From 368c9bc95fca46ec34ca073a13cd88c6393f534f Mon Sep 17 00:00:00 2001 From: shockrah Date: Wed, 7 Apr 2021 21:06:08 -0700 Subject: [PATCH] + Better logging in main + --- json-api/src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/json-api/src/main.rs b/json-api/src/main.rs index a0c6e8c..fb70cc4 100644 --- a/json-api/src/main.rs +++ b/json-api/src/main.rs @@ -64,7 +64,7 @@ async fn route_dispatcher( const GET: &Method = &Method::GET; const POST: &Method = &Method::POST; const DELETE: &Method = &Method::DELETE; - println!("[INFO] {}: {}", meth, path); + println!("[HTTP] {}: {}", meth, path); match (meth, path) { /* INVITES */ (POST, routes::INVITE_CREATE) => invites::create(pool, resp, params).await, @@ -89,7 +89,7 @@ async fn route_dispatcher( /* META ROUTE */ (GET, routes::META) => meta::server_meta(resp).await, _ => { - println!("[INFO]\tNOT FOUND: {}: {}", meth, path); + println!("[HTTP]\tNOT FOUND: {}: {}", meth, path); *resp.status_mut() = StatusCode::NOT_FOUND } } @@ -117,10 +117,10 @@ async fn main_responder(request: Request) -> Result, hyper: route_dispatcher(&DB_POOL, &mut response, &method, path, body, params, headers).await; }, LoginValid => { + println!("[HTTP] POST /login"); auth::login_get_jwt(&mut response, params).await; }, NoKey | BadKey => { - println!("[DEBUG] NoKey | BadKey"); *response.status_mut() = StatusCode::UNAUTHORIZED; }, ServerIssue(msg) => { @@ -130,7 +130,7 @@ async fn main_responder(request: Request) -> Result, hyper: } } else { - println!("[INFO] PARSER: Parameter parsing failed"); + println!("[HTTP] PARSER: Parameter parsing failed"); *response.status_mut() = StatusCode::BAD_REQUEST; } Ok(response)