* Better logging in meta module(more logging tags)

This commit is contained in:
shockrah 2021-05-12 14:14:30 -07:00
parent fbcf16b735
commit 24b5f11b13

View File

@ -32,7 +32,7 @@ lazy_static! {
let rr: JsonResult<Config> = serde_json::from_reader(reader);
match rr {
Ok(meta) => meta,
Err(e) => panic!("{}", e)
Err(e) => panic!("[HTTP] [FATAL-INIT] {}", e)
}
},
@ -82,7 +82,7 @@ pub async fn add_neighbor(p: &Pool, response: &mut Response<Body>, body: Body) {
match row.is_some() {
true => *response.status_mut() = StatusCode::CONFLICT,
false => if let Err(e) = db::neighbors::add_neighbor(p, neighbor).await {
eprintln!("{}", e);
eprintln!("[HTTP] [DB-LIB] {}", e);
}
};
} else {
@ -108,14 +108,14 @@ pub async fn update_neighbor(p: &Pool, response: &mut Response<Body>, params: Ha
Ok(row) => if row.is_some() {
if let Err(e) = db::neighbors::update(p, target_url, neighbor).await {
*response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
eprintln!("/neighbor/update [DB-LIB] {}", e);
eprintln!("[HTTP] [DB-LIB] /neighbor/update [DB-LIB] {}", e);
}
// Nothing to do on success 200 is already set by hyper
} else{
*response.status_mut() = StatusCode::NOT_FOUND;
},
Err(e) => {
eprintln!("/neighbor/update {}", e);
eprintln!("[HTTP] [DB-LIB] /neighbor/update {}", e);
*response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
}
}