switch logging over to log & env_logger crate
This commit is contained in:
@@ -45,11 +45,11 @@ impl IntoResponse for AuthError {
|
||||
Self::InvalidBase64(_) => (StatusCode::BAD_REQUEST, self.to_string()).into_response(),
|
||||
Self::InvalidUtf8(_) => (StatusCode::BAD_REQUEST, self.to_string()).into_response(),
|
||||
Self::DatabaseError(e) => {
|
||||
eprintln!("[ERROR] Database error occured: {e}");
|
||||
log::error!("[ERROR] Database error occured: {e}");
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, ISE_MSG.to_string()).into_response()
|
||||
}
|
||||
Self::PassHashError(e) => {
|
||||
eprintln!("[ERROR] A passwordhash error occured: {e}");
|
||||
log::error!("[ERROR] A passwordhash error occured: {e}");
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, ISE_MSG.to_string()).into_response()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ pub static DUMMY_PASSWORD_PHC: LazyLock<String> = LazyLock::new(|| {
|
||||
});
|
||||
pub fn init_password_dummies() {
|
||||
let _ = &*DUMMY_PASSWORD_PHC;
|
||||
println!("Password hashing setup finished");
|
||||
log::info!("Password hashing setup finished");
|
||||
}
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
|
||||
@@ -154,10 +154,10 @@ impl User {
|
||||
pub fn regenerate_infradmin_password(&mut self) -> Result<(), UserError> {
|
||||
let passw = auth::generate_token(auth::TokenSize::Char16);
|
||||
self.set_password(Some(&passw))?;
|
||||
println!("[USERS] The infradmin account password has been (re)generated.");
|
||||
println!("[USERS] Handle: {}", self.handle.as_str());
|
||||
println!("[USERS] Password: {}", passw);
|
||||
println!("[USERS] The infradmin is urged to change this password to a secure one.\n");
|
||||
log::info!("[USERS] The infradmin account password has been (re)generated.");
|
||||
log::info!("[USERS] Handle: {}", self.handle.as_str());
|
||||
log::info!("[USERS] Password: {}", passw);
|
||||
log::info!("[USERS] The infradmin is urged to change this password to a secure one.\n");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -204,11 +204,11 @@ impl IntoResponse for UserError {
|
||||
fn into_response(self) -> Response {
|
||||
match self {
|
||||
Self::DatabaseError(e) => {
|
||||
eprintln!("[ERROR] Database error occured: {e}");
|
||||
log::error!("[ERROR] Database error occured: {e}");
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, ISE_MSG.into())
|
||||
}
|
||||
Self::PassHashError(e) => {
|
||||
eprintln!("[ERROR] A passwordhash error occured: {e}");
|
||||
log::error!("[ERROR] A passwordhash error occured: {e}");
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, ISE_MSG.into())
|
||||
}
|
||||
Self::UserHandleError(_) => (StatusCode::BAD_REQUEST, self.to_string()),
|
||||
|
||||
@@ -52,7 +52,7 @@ impl IntoResponse for SessionError {
|
||||
fn into_response(self) -> Response {
|
||||
match self {
|
||||
Self::DatabaseError(e) => {
|
||||
eprintln!("[ERROR] Database error occured: {e}");
|
||||
log::error!("[ERROR] Database error occured: {e}");
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, ISE_MSG.into())
|
||||
}
|
||||
Self::NoSessionWithId(_) => (StatusCode::BAD_REQUEST, self.to_string()),
|
||||
|
||||
Reference in New Issue
Block a user