fix: cleanup mailjet webhook logging
This commit is contained in:
@@ -15,6 +15,8 @@ use Symfony\Component\Routing\Attribute\Route;
|
|||||||
|
|
||||||
final class MailjetNewsletterWebhookController extends AbstractController
|
final class MailjetNewsletterWebhookController extends AbstractController
|
||||||
{
|
{
|
||||||
|
private int $ignored = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<int, string> $mailjetLists
|
* @param array<int, string> $mailjetLists
|
||||||
*/
|
*/
|
||||||
@@ -35,6 +37,7 @@ final class MailjetNewsletterWebhookController extends AbstractController
|
|||||||
|
|
||||||
$events = $this->normalizeEvents($payload);
|
$events = $this->normalizeEvents($payload);
|
||||||
$dispatched = 0;
|
$dispatched = 0;
|
||||||
|
$this->ignored = 0;
|
||||||
|
|
||||||
foreach ($events as $eventPayload) {
|
foreach ($events as $eventPayload) {
|
||||||
$message = $this->createMessage($eventPayload);
|
$message = $this->createMessage($eventPayload);
|
||||||
@@ -46,9 +49,10 @@ final class MailjetNewsletterWebhookController extends AbstractController
|
|||||||
++$dispatched;
|
++$dispatched;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->info('Accepted Mailjet newsletter webhook payload', [
|
$this->logger->info('Processed Mailjet newsletter webhook payload', [
|
||||||
'events' => count($events),
|
'events' => count($events),
|
||||||
'dispatched' => $dispatched,
|
'dispatched' => $dispatched,
|
||||||
|
'ignored' => $this->ignored,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return new JsonResponse(['success' => true, 'dispatched' => $dispatched]);
|
return new JsonResponse(['success' => true, 'dispatched' => $dispatched]);
|
||||||
@@ -103,7 +107,9 @@ final class MailjetNewsletterWebhookController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (false === $this->isHandledListId($mailjetListId)) {
|
if (false === $this->isHandledListId($mailjetListId)) {
|
||||||
$this->logger->info('Ignored Mailjet newsletter webhook event for unconfigured list', [
|
++$this->ignored;
|
||||||
|
|
||||||
|
$this->logger->debug('Ignored Mailjet newsletter webhook event for unconfigured list', [
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'mailjet_list_id' => $mailjetListId,
|
'mailjet_list_id' => $mailjetListId,
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user