use full qualified name for log statements
This commit is contained in:
parent
87dc7547b8
commit
d3a3b1e1f2
@ -44,7 +44,7 @@ impl ResponseError for DomainError {
|
||||
})
|
||||
}
|
||||
DomainError::DbError { source: _ } => {
|
||||
error!("{}", err);
|
||||
log::error!("{}", err);
|
||||
HttpResponse::InternalServerError().json(ErrorModel {
|
||||
// error_code: 500,
|
||||
success: false,
|
||||
@ -52,7 +52,7 @@ impl ResponseError for DomainError {
|
||||
})
|
||||
}
|
||||
DomainError::DbPoolError { source: _ } => {
|
||||
error!("{}", err);
|
||||
log::error!("{}", err);
|
||||
HttpResponse::InternalServerError().json(ErrorModel {
|
||||
// error_code: 500,
|
||||
success: false,
|
||||
@ -74,7 +74,7 @@ impl ResponseError for DomainError {
|
||||
})
|
||||
}
|
||||
DomainError::ThreadPoolError { message: _ } => {
|
||||
error!("{}", err);
|
||||
log::error!("{}", err);
|
||||
HttpResponse::InternalServerError().json(ErrorModel {
|
||||
// error_code: 400,
|
||||
success: false,
|
||||
|
@ -3,8 +3,6 @@
|
||||
extern crate diesel;
|
||||
#[macro_use]
|
||||
extern crate derive_new;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
mod actions;
|
||||
mod errors;
|
||||
@ -99,7 +97,7 @@ pub fn app_logger() -> Logger {
|
||||
|
||||
pub async fn run(addr: String, app_data: AppData) -> io::Result<()> {
|
||||
let bi = get_build_info();
|
||||
info!("Starting {} {}", bi.crate_info.name, bi.crate_info.version);
|
||||
log::info!("Starting {} {}", bi.crate_info.name, bi.crate_info.version);
|
||||
println!(
|
||||
r#"
|
||||
__ .__ .___
|
||||
|
@ -45,7 +45,7 @@ pub async fn logout(
|
||||
) -> Result<HttpResponse, Error> {
|
||||
let maybe_identity = id.identity();
|
||||
let response = if let Some(identity) = maybe_identity {
|
||||
info!("Logging out {user}", user = identity);
|
||||
log::info!("Logging out {user}", user = identity);
|
||||
id.forget();
|
||||
HttpResponse::Found().header("location", "/").finish()
|
||||
} else {
|
||||
|
@ -61,7 +61,7 @@ pub async fn get_all_users(
|
||||
.await
|
||||
.map_err(|err| DomainError::new_thread_pool_error(err.to_string()))?;
|
||||
|
||||
debug!("{:?}", users);
|
||||
log::debug!("{:?}", users);
|
||||
|
||||
if !users.is_empty() {
|
||||
Ok(HttpResponse::Ok().json(users))
|
||||
@ -87,7 +87,7 @@ pub async fn add_user(
|
||||
})
|
||||
.await
|
||||
.map(|user| {
|
||||
debug!("{:?}", user);
|
||||
log::debug!("{:?}", user);
|
||||
HttpResponse::Created().json(user)
|
||||
}),
|
||||
|
||||
|
@ -6,7 +6,7 @@ pub trait LogErrorResult<T, E> {
|
||||
impl<T, E: Display> LogErrorResult<T, E> for Result<T, E> {
|
||||
fn log_err(self) -> Result<T, E> {
|
||||
self.map_err(|err| {
|
||||
error!("{}", err.to_string());
|
||||
log::error!("{}", err.to_string());
|
||||
err
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user