Improve logging for disabled SMS and email sending, including recipient and message details

This commit is contained in:
Marco Pedone 2025-08-10 17:09:48 +02:00
parent a427edbe04
commit 19594637e7
2 changed files with 15 additions and 5 deletions

View file

@ -135,8 +135,13 @@ export const SendMessage = async (data: MinimalSMSData) => {
id: "SMS_OFF", id: "SMS_OFF",
}); });
if (smsFlag === "true") { if (smsFlag === "true") {
console.warn("SMS sending is disabled"); console.warn(
return { success: true, message: "SMS sending is disabled" }; `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 { try {
const auth = await login("arcasms2018", "123qwe456rtyA."); const auth = await login("arcasms2018", "123qwe456rtyA.");
@ -154,7 +159,7 @@ export const SendMessage = async (data: MinimalSMSData) => {
mailType: "generic", mailType: "generic",
props: { props: {
title: "Errore invio SMS", 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)}`,
}, },
}); });
} }

View file

@ -195,8 +195,13 @@ export const NewMail = async ({
id: "EMAIL_OFF", id: "EMAIL_OFF",
}); });
if (emailFlag === "true") { if (emailFlag === "true") {
console.warn("Email sending is disabled"); console.warn(
return { success: true, message: "Email sending is disabled" }; `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 { try {
const { html } = await genMail({ ...mail }); const { html } = await genMail({ ...mail });