From ccde4a437999267ae1f62316bebcc09ea7dc027d Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Mon, 16 Sep 2024 15:41:52 +0200
Subject: Use tracing rather than std(out|err)

---
 src/db.rs                  | 2 +-
 src/graphql/types/alert.rs | 6 +++---
 src/graphql/types/jwt.rs   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/db.rs b/src/db.rs
index b74550b..4a9e9a7 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -11,7 +11,7 @@ pub async fn setup() -> Result<Client, AppError> {
     // Spawn a new task to run the connection to the database
     tokio::spawn(async move {
         if let Err(e) = connection.await {
-            eprintln!("Database connection error: {}", e);
+            tracing::error!("Database connection error: {}", e);
         }
     });
 
diff --git a/src/graphql/types/alert.rs b/src/graphql/types/alert.rs
index 2ee0087..69e8f31 100644
--- a/src/graphql/types/alert.rs
+++ b/src/graphql/types/alert.rs
@@ -338,7 +338,7 @@ pub mod mutations {
                 )
                 .await
                 {
-                    eprintln!(
+                    tracing::error!(
                         "Error for `{}`: {}",
                         format!("alert-{}-text-1.mp3", alert.id),
                         e
@@ -351,7 +351,7 @@ pub mod mutations {
                 )
                 .await
                 {
-                    eprintln!(
+                    tracing::error!(
                         "Error for `{}`: {}",
                         format!("alert-{}-text-2.mp3", alert.id),
                         e
@@ -363,7 +363,7 @@ pub mod mutations {
                 )
                 .await
                 {
-                    eprintln!(
+                    tracing::error!(
                         "Error for `{}`: {}",
                         format!("alert-{}-text-3.mp3", alert.id),
                         e
diff --git a/src/graphql/types/jwt.rs b/src/graphql/types/jwt.rs
index 5656dc5..b2a09c3 100644
--- a/src/graphql/types/jwt.rs
+++ b/src/graphql/types/jwt.rs
@@ -110,7 +110,7 @@ where
                                 AppError::InvalidToken
                             }
                             _ => {
-                                eprintln!("{err:?}");
+                                tracing::error!("{err:?}");
                                 AppError::Unauthorized
                             }
                         })?;
-- 
cgit v1.2.3-18-g5258