From e7deb6e04c7f69af9568d6140c19c943c4cccfcd Mon Sep 17 00:00:00 2001 From: antifallobst Date: Sat, 30 Mar 2024 19:19:58 +0100 Subject: [PATCH] refactor: removed all imports of the log crate --- src/api/endpoints/account/invite.rs | 3 +-- src/api/endpoints/account/mod.rs | 2 +- src/api/endpoints/relay/mod.rs | 3 +-- src/api/endpoints/relay/relay_id/user/user_id.rs | 3 +-- src/config.rs | 5 ++--- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/api/endpoints/account/invite.rs b/src/api/endpoints/account/invite.rs index 56fda04..e02ef10 100644 --- a/src/api/endpoints/account/invite.rs +++ b/src/api/endpoints/account/invite.rs @@ -1,7 +1,6 @@ use crate::backend::Backend; use actix_web::{post, web, HttpResponse, Responder}; use actix_web_httpauth::extractors::bearer::BearerAuth; -use log::error; use serde::Serialize; #[derive(Debug, Serialize)] @@ -13,7 +12,7 @@ struct NewResponse { pub async fn new(backend: web::Data, auth: BearerAuth) -> impl Responder { match backend.create_invite_token(auth.token()).await { Err(e) => { - error!("{e}"); + log::error!("{e}"); HttpResponse::InternalServerError().finish() } Ok(res) => match res { diff --git a/src/api/endpoints/account/mod.rs b/src/api/endpoints/account/mod.rs index dbe5ec3..b9ddb71 100644 --- a/src/api/endpoints/account/mod.rs +++ b/src/api/endpoints/account/mod.rs @@ -25,7 +25,7 @@ pub async fn register( let body = body.into_inner(); match backend.account_register(body.token, body.password).await { Err(e) => { - error!("{e}"); + log::error!("{e}"); HttpResponse::InternalServerError().finish() } Ok(res) => match res { diff --git a/src/api/endpoints/relay/mod.rs b/src/api/endpoints/relay/mod.rs index d8b2d05..8b3067b 100644 --- a/src/api/endpoints/relay/mod.rs +++ b/src/api/endpoints/relay/mod.rs @@ -3,7 +3,6 @@ pub mod relay_id; use crate::backend::Backend; use actix_web::{post, web, HttpResponse, Responder}; use actix_web_httpauth::extractors::bearer::BearerAuth; -use log::error; use serde::Serialize; #[derive(Debug, Serialize)] @@ -16,7 +15,7 @@ struct CreateResponse { pub async fn create(backend: web::Data, auth: BearerAuth) -> impl Responder { match backend.create_relay(auth.token()).await { Err(e) => { - error!("{e}"); + log::error!("{e}"); HttpResponse::InternalServerError().finish() } Ok(res) => match res { diff --git a/src/api/endpoints/relay/relay_id/user/user_id.rs b/src/api/endpoints/relay/relay_id/user/user_id.rs index ecf7c20..8d8d76e 100644 --- a/src/api/endpoints/relay/relay_id/user/user_id.rs +++ b/src/api/endpoints/relay/relay_id/user/user_id.rs @@ -1,7 +1,6 @@ use crate::{backend::Backend, Base64Encoding}; use actix_web::{get, web, HttpResponse, Responder}; use actix_web_httpauth::extractors::bearer::BearerAuth; -use log::error; use serde::Serialize; use std::str::FromStr; use uuid::Uuid; @@ -32,7 +31,7 @@ pub async fn public_key( .await { Err(e) => { - error!("{e}"); + log::error!("{e}"); HttpResponse::InternalServerError().finish() } Ok(res) => match res { diff --git a/src/config.rs b/src/config.rs index 4847c0c..b99af06 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,4 @@ use anyhow::{bail, Result}; -use log::info; use std::env; #[derive(Debug)] @@ -15,7 +14,7 @@ impl Config { pub fn from_env() -> Result { Ok(Self { addr: env::var("CR_ADDRESS").unwrap_or_else(|_| { - info!("Using default address 0.0.0.0"); + log::info!("Using default address 0.0.0.0"); "0.0.0.0".to_string() }), port: match env::var("CR_PORT") { @@ -23,7 +22,7 @@ impl Config { Ok(port) => port, Err(_) => bail!("Failed to parse environment variable CR_PORT: '{str}' is not a valid port number!"), }, - Err(_) => { info!("Using default port 42069"); 42069 } + Err(_) => { log::info!("Using default port 42069"); 42069 } }, database: match env::var("CR_DATABASE") { Ok(db) => db,