refactor: removed all imports of the log crate

This commit is contained in:
antifallobst 2024-03-30 19:19:58 +01:00
parent 28d3d03661
commit 7c6a5445c2
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
4 changed files with 5 additions and 9 deletions

View File

@ -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<Backend>, 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 {

View File

@ -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<Backend>, 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 {

View File

@ -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 {

View File

@ -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<Self> {
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,