From 8a4544fc183e112564bdc6ac8511152c92ce7c56 Mon Sep 17 00:00:00 2001 From: Naz Date: Sun, 12 Oct 2025 11:00:08 +0100 Subject: =?UTF-8?q?=E2=9C=A8feat:=20add=20tracing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/errors.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/errors.rs') diff --git a/src/errors.rs b/src/errors.rs index 6b53c2d..dc5a034 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -31,6 +31,9 @@ pub enum Error { #[from] ParseIntError(std::num::ParseIntError), + + #[from] + TracingSubEnvError(tracing_subscriber::filter::FromEnvError), } impl core::fmt::Display for Error { @@ -48,6 +51,7 @@ impl core::fmt::Display for Error { Error::TomlDeError(e) => write!(fmt, "TOML deserialization error: {e}"), Error::TomlSerError(e) => write!(fmt, "TOML serialization error: {e}"), Error::ParseIntError(e) => write!(fmt, "Parsing error: {e}"), + Error::TracingSubEnvError(e) => write!(fmt, "Environment variable error: {e}"), } } } @@ -88,9 +92,13 @@ impl IntoResponse for Error { StatusCode::INTERNAL_SERVER_ERROR, format!("Parsing error: {e}"), ), + Error::TracingSubEnvError(ref e) => ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("Environment variable error: {e}"), + ), }; - println!("{} {}", &status, &error_message); + tracing::error!("{} {}", &status, &error_message); (status, error_message).into_response() } } -- cgit v1.2.3