From 2cbeb23d8fe06ec83344c06cb8a2014615a02d23 Mon Sep 17 00:00:00 2001 From: paulwer Date: Sun, 24 Mar 2024 12:51:24 +0100 Subject: [PATCH] minor logging improvements --- app/Jobs/Brevo/ProcessBrevoInboundWebhook.php | 6 +++--- app/Jobs/Mailgun/ProcessMailgunInboundWebhook.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Jobs/Brevo/ProcessBrevoInboundWebhook.php b/app/Jobs/Brevo/ProcessBrevoInboundWebhook.php index aab2adad3a29..d97fb7245496 100644 --- a/app/Jobs/Brevo/ProcessBrevoInboundWebhook.php +++ b/app/Jobs/Brevo/ProcessBrevoInboundWebhook.php @@ -124,13 +124,13 @@ class ProcessBrevoInboundWebhook implements ShouldQueue // match company $company = MultiDB::findAndSetDbByExpenseMailbox($recipient); if (!$company) { - Log::info('unknown Expense Mailbox occured while handling an inbound email from brevo: ' . $recipient); + Log::info('[ProcessBrevoInboundWebhook] unknown Expense Mailbox occured while handling an inbound email from brevo: ' . $recipient); continue; } $company_brevo_secret = $company->settings?->email_sending_method === 'client_brevo' && $company->settings?->brevo_secret ? $company->settings?->brevo_secret : null; if (empty ($company_brevo_secret) && empty (config('services.brevo.secret'))) - throw new \Error("no brevo credenitals found, we cannot get the attachement"); + throw new \Error("[ProcessBrevoInboundWebhook] no brevo credenitals found, we cannot get the attachement"); // prepare data for ingresEngine $ingresEmail = new IngresEmail(); @@ -156,7 +156,7 @@ class ProcessBrevoInboundWebhook implements ShouldQueue } catch (\Error $e) { if (config('services.brevo.secret')) { - Log::info("Error while downloading with company credentials, we try to use defaul credentials now..."); + Log::info("[ProcessBrevoInboundWebhook] Error while downloading with company credentials, we try to use default credentials now..."); $brevo = new InboundParsingApi(null, Configuration::getDefaultConfiguration()->setApiKey("api-key", config('services.brevo.secret'))); $attachment = $brevo->getInboundEmailAttachment($attachment["DownloadToken"]); diff --git a/app/Jobs/Mailgun/ProcessMailgunInboundWebhook.php b/app/Jobs/Mailgun/ProcessMailgunInboundWebhook.php index 11e81f1b0633..eac0e1bd04d2 100644 --- a/app/Jobs/Mailgun/ProcessMailgunInboundWebhook.php +++ b/app/Jobs/Mailgun/ProcessMailgunInboundWebhook.php @@ -168,7 +168,7 @@ class ProcessMailgunInboundWebhook implements ShouldQueue // match company $company = MultiDB::findAndSetDbByExpenseMailbox($recipient); if (!$company) { - Log::info('unknown Expense Mailbox occured while handling an inbound email from mailgun: ' . $recipient); + Log::info('[ProcessMailgunInboundWebhook] unknown Expense Mailbox occured while handling an inbound email from mailgun: ' . $recipient); return; } @@ -176,7 +176,7 @@ class ProcessMailgunInboundWebhook implements ShouldQueue $company_mailgun_domain = $company->settings?->email_sending_method === 'client_mailgun' && $company->settings?->mailgun_domain ? $company->settings?->mailgun_domain : null; $company_mailgun_secret = $company->settings?->email_sending_method === 'client_mailgun' && $company->settings?->mailgun_secret ? $company->settings?->mailgun_secret : null; if (!($company_mailgun_domain && $company_mailgun_secret) && !(config('services.mailgun.domain') && config('services.mailgun.secret'))) - throw new \Error("no mailgun credenitals found, we cannot get the attachements and files"); + throw new \Error("[ProcessMailgunInboundWebhook] no mailgun credenitals found, we cannot get the attachements and files"); $mail = null; if ($company_mailgun_domain && $company_mailgun_secret) { @@ -190,7 +190,7 @@ class ProcessMailgunInboundWebhook implements ShouldQueue $mail = json_decode(file_get_contents($messageUrl)); } catch (\Error $e) { if (config('services.mailgun.secret')) { - Log::info("Error while downloading with company credentials, we try to use defaul credentials now..."); + Log::info("[ProcessMailgunInboundWebhook] Error while downloading with company credentials, we try to use default credentials now..."); $credentials = config('services.mailgun.domain') . ":" . config('services.mailgun.secret') . "@"; $messageUrl = explode("|", $this->input)[1]; @@ -238,7 +238,7 @@ class ProcessMailgunInboundWebhook implements ShouldQueue } catch (\Error $e) { if (config('services.mailgun.secret')) { - Log::info("Error while downloading with company credentials, we try to use defaul credentials now..."); + Log::info("[ProcessMailgunInboundWebhook] Error while downloading with company credentials, we try to use default credentials now..."); $credentials = config('services.mailgun.domain') . ":" . config('services.mailgun.secret') . "@"; $url = $attachment->url;