+ 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 GET: &Method = &Method::GET;
|
||||||
const POST: &Method = &Method::POST;
|
const POST: &Method = &Method::POST;
|
||||||
const DELETE: &Method = &Method::DELETE;
|
const DELETE: &Method = &Method::DELETE;
|
||||||
println!("[INFO] {}: {}", meth, path);
|
println!("[HTTP] {}: {}", meth, path);
|
||||||
match (meth, path) {
|
match (meth, path) {
|
||||||
/* INVITES */
|
/* INVITES */
|
||||||
(POST, routes::INVITE_CREATE) => invites::create(pool, resp, params).await,
|
(POST, routes::INVITE_CREATE) => invites::create(pool, resp, params).await,
|
||||||
@ -89,7 +89,7 @@ async fn route_dispatcher(
|
|||||||
/* META ROUTE */
|
/* META ROUTE */
|
||||||
(GET, routes::META) => meta::server_meta(resp).await,
|
(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
|
*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;
|
route_dispatcher(&DB_POOL, &mut response, &method, path, body, params, headers).await;
|
||||||
},
|
},
|
||||||
LoginValid => {
|
LoginValid => {
|
||||||
|
println!("[HTTP] POST /login");
|
||||||
auth::login_get_jwt(&mut response, params).await;
|
auth::login_get_jwt(&mut response, params).await;
|
||||||
},
|
},
|
||||||
NoKey | BadKey => {
|
NoKey | BadKey => {
|
||||||
println!("[DEBUG] NoKey | BadKey");
|
|
||||||
*response.status_mut() = StatusCode::UNAUTHORIZED;
|
*response.status_mut() = StatusCode::UNAUTHORIZED;
|
||||||
},
|
},
|
||||||
ServerIssue(msg) => {
|
ServerIssue(msg) => {
|
||||||
@ -130,7 +130,7 @@ async fn main_responder(request: Request<Body>) -> Result<Response<Body>, hyper:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
println!("[INFO] PARSER: Parameter parsing failed");
|
println!("[HTTP] PARSER: Parameter parsing failed");
|
||||||
*response.status_mut() = StatusCode::BAD_REQUEST;
|
*response.status_mut() = StatusCode::BAD_REQUEST;
|
||||||
}
|
}
|
||||||
Ok(response)
|
Ok(response)
|
||||||
|
Loading…
Reference in New Issue
Block a user