From 19594637e7656934901dee251359a812ea678c41 Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Sun, 10 Aug 2025 17:09:48 +0200 Subject: [PATCH] Improve logging for disabled SMS and email sending, including recipient and message details --- .../src/server/controllers/skebby.controller.ts | 11 ++++++++--- apps/infoalloggi/src/server/services/mailer.ts | 9 +++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/infoalloggi/src/server/controllers/skebby.controller.ts b/apps/infoalloggi/src/server/controllers/skebby.controller.ts index 9601e18..d8128ca 100644 --- a/apps/infoalloggi/src/server/controllers/skebby.controller.ts +++ b/apps/infoalloggi/src/server/controllers/skebby.controller.ts @@ -135,8 +135,13 @@ export const SendMessage = async (data: MinimalSMSData) => { id: "SMS_OFF", }); if (smsFlag === "true") { - console.warn("SMS sending is disabled"); - return { success: true, message: "SMS sending is disabled" }; + console.warn( + `SMS sending is disabled to:${data.recipient.join(", ")} Mgs:${data.message}`, + ); + return { + success: true, + message: `SMS sending is disabled: to:${data.recipient.join(", ")} Mgs:${data.message}`, + }; } try { const auth = await login("arcasms2018", "123qwe456rtyA."); @@ -154,7 +159,7 @@ export const SendMessage = async (data: MinimalSMSData) => { mailType: "generic", props: { title: "Errore invio SMS", - testo: `Errore durante l'invio dell'SMS: ${error instanceof Error ? error.message : String(error)}`, + testo: `Errore durante l'invio dell'SMS: to:${data.recipient.join(", ")} Mgs:${data.message}; ${error instanceof Error ? error.message : String(error)}`, }, }); } diff --git a/apps/infoalloggi/src/server/services/mailer.ts b/apps/infoalloggi/src/server/services/mailer.ts index afc1141..3f74d5a 100644 --- a/apps/infoalloggi/src/server/services/mailer.ts +++ b/apps/infoalloggi/src/server/services/mailer.ts @@ -195,8 +195,13 @@ export const NewMail = async ({ id: "EMAIL_OFF", }); if (emailFlag === "true") { - console.warn("Email sending is disabled"); - return { success: true, message: "Email sending is disabled" }; + console.warn( + `Email sending is disabled to:${to} subj:${subject} msgType: ${mail.mailType}`, + ); + return { + success: true, + message: `Email sending is disabled to:${to} subj:${subject} msgType: ${mail.mailType}`, + }; } try { const { html } = await genMail({ ...mail });