mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-01 09:48:25 +00:00
Merge branch 'send-notification-log-to-channel' into 'master'
Send notifications log to dedicated `notifierLogger` channel if available See merge request Chill-Projet/chill-bundles!905
This commit is contained in:
7
.changes/unreleased/DX-20251027-150053.yaml
Normal file
7
.changes/unreleased/DX-20251027-150053.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
kind: DX
|
||||
body: |
|
||||
Send notifications log to dedicated channel, if it exists
|
||||
time: 2025-10-27T15:00:53.309372316+01:00
|
||||
custom:
|
||||
Issue: ""
|
||||
SchemaChange: No schema change
|
||||
@@ -18,7 +18,7 @@ use Symfony\Component\Notifier\Event\SentMessageEvent;
|
||||
final readonly class SentMessageEventSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(
|
||||
private LoggerInterface $logger,
|
||||
private LoggerInterface $notifierLogger, // will be send to "notifierLogger" if it exists
|
||||
) {}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
@@ -33,9 +33,9 @@ final readonly class SentMessageEventSubscriber implements EventSubscriberInterf
|
||||
$message = $event->getMessage();
|
||||
|
||||
if (null === $message->getMessageId()) {
|
||||
$this->logger->info('[sms] a sms message did not had any id after sending.', ['validReceiversI' => $message->getOriginalMessage()->getRecipientId()]);
|
||||
$this->notifierLogger->info('[sms] a sms message did not had any id after sending.', ['validReceiversI' => $message->getOriginalMessage()->getRecipientId()]);
|
||||
} else {
|
||||
$this->logger->warning('[sms] a sms was sent', ['validReceiversI' => $message->getOriginalMessage()->getRecipientId(), 'idsI' => $message->getMessageId()]);
|
||||
$this->notifierLogger->warning('[sms] a sms was sent', ['validReceiversI' => $message->getOriginalMessage()->getRecipientId(), 'idsI' => $message->getMessageId()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user