From a1e55b286584c162a55f07e9a8c843b6291549cb Mon Sep 17 00:00:00 2001 From: taco-paco Date: Wed, 16 Oct 2024 13:23:23 +0300 Subject: [PATCH 1/3] fix: excessive info from /health --- api/src/handlers/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/handlers/mod.rs b/api/src/handlers/mod.rs index c6469a5..4de39d1 100644 --- a/api/src/handlers/mod.rs +++ b/api/src/handlers/mod.rs @@ -26,7 +26,7 @@ lazy_static! { static ref SPAWN_SEMAPHORE: Semaphore = Semaphore::new(PROCESS_SPAWN_LIMIT); } -#[instrument] +#[instrument(skip(engine))] #[get("/health")] pub async fn health(engine: &State) -> HealthCheckResponse { info!("/health"); From 704721389c94f879e0510ebe0d220700b231bffc Mon Sep 17 00:00:00 2001 From: taco-paco Date: Wed, 16 Oct 2024 13:26:39 +0300 Subject: [PATCH 2/3] fix: skip request_json in verify --- api/src/handlers/verify.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/handlers/verify.rs b/api/src/handlers/verify.rs index d104253..033aa5c 100644 --- a/api/src/handlers/verify.rs +++ b/api/src/handlers/verify.rs @@ -40,7 +40,7 @@ pub async fn verify( }) } -#[instrument(skip(_rate_limited, engine))] +#[instrument(skip(verification_request_json, _rate_limited, engine))] #[post("/verify-async", format = "json", data = "")] pub fn verify_async( verification_request_json: Json, From 41a90050aae5a60b31800860ecfa5a3a30f79bcc Mon Sep 17 00:00:00 2001 From: taco-paco Date: Wed, 16 Oct 2024 16:11:35 +0300 Subject: [PATCH 3/3] feat: per file logging separate from console logging --- api/src/tracing_log.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/api/src/tracing_log.rs b/api/src/tracing_log.rs index becd1a8..49cf7ae 100644 --- a/api/src/tracing_log.rs +++ b/api/src/tracing_log.rs @@ -1,14 +1,12 @@ use tracing_appender::rolling; - +use tracing_subscriber::field::MakeExt; use tracing_subscriber::fmt::writer::MakeWriterExt; use tracing_subscriber::registry::LookupSpan; +use tracing_subscriber::Layer; use tracing_subscriber::{prelude::*, EnvFilter}; - -use tracing_subscriber::field::MakeExt; +use yansi::Paint; use crate::errors::CoreError; -use tracing_subscriber::Layer; -use yansi::Paint; pub enum LogType { Formatted, @@ -115,7 +113,8 @@ pub fn init_logger() -> Result<(), CoreError> { let rolling_files = tracing_subscriber::fmt::layer() .json() .with_writer(all_files) - .with_ansi(false); + .with_ansi(false) + .with_filter(filter_layer(LogLevel::Debug)); let log_type = LogType::from(std::env::var("LOG_TYPE").unwrap_or_else(|_| "json".to_string())); let log_level = LogLevel::from( @@ -132,8 +131,7 @@ pub fn init_logger() -> Result<(), CoreError> { )?, LogType::Json => tracing::subscriber::set_global_default( tracing_subscriber::registry() - .with(json_logging_layer()) - .with(filter_layer(log_level)) + .with(json_logging_layer().with_filter(filter_layer(log_level))) .with(rolling_files), )?, };