Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
Skip engine print in /health (#228)
Browse files Browse the repository at this point in the history
* fix: excessive info from /health

* fix: skip request_json in verify

* feat: per file logging separate from console logging
  • Loading branch information
taco-paco authored Oct 16, 2024
1 parent 5db2e6b commit 9095187
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion api/src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<WorkerEngine>) -> HealthCheckResponse {
info!("/health");
Expand Down
2 changes: 1 addition & 1 deletion api/src/handlers/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<verification_request_json>")]
pub fn verify_async(
verification_request_json: Json<VerificationRequest>,
Expand Down
14 changes: 6 additions & 8 deletions api/src/tracing_log.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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(
Expand All @@ -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),
)?,
};
Expand Down

0 comments on commit 9095187

Please sign in to comment.