+ Better logging in main
+
This commit is contained in:
parent
d030accddc
commit
368c9bc95f
@ -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<Body>) -> Result<Response<Body>, 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<Body>) -> Result<Response<Body>, hyper:
|
||||
}
|
||||
}
|
||||
else {
|
||||
println!("[INFO] PARSER: Parameter parsing failed");
|
||||
println!("[HTTP] PARSER: Parameter parsing failed");
|
||||
*response.status_mut() = StatusCode::BAD_REQUEST;
|
||||
}
|
||||
Ok(response)
|
||||
|
Loading…
Reference in New Issue
Block a user