mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-09 09:19:51 +00:00
Add log SMS when a message is sent
Introduced a new event subscriber to log SMS sent events with details such as recipient and message IDs. This enhances monitoring and debugging of SMS delivery.
This commit is contained in:
parent
594ed4a5b4
commit
b02820407c
@ -1,6 +1,7 @@
|
|||||||
framework:
|
framework:
|
||||||
notifier:
|
notifier:
|
||||||
texter_transports:
|
texter_transports:
|
||||||
|
#ovhcloud: '%env(OVHCLOUD_DSN)%'
|
||||||
ovhcloud: '%env(SHORT_MESSAGE_DSN)%'
|
ovhcloud: '%env(SHORT_MESSAGE_DSN)%'
|
||||||
channel_policy:
|
channel_policy:
|
||||||
# use chat/slack, chat/telegram, sms/twilio or sms/nexmo
|
# use chat/slack, chat/telegram, sms/twilio or sms/nexmo
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Service\Notifier;
|
||||||
|
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Symfony\Component\Notifier\Event\SentMessageEvent;
|
||||||
|
|
||||||
|
final readonly class SentMessageEventSubscriber implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private LoggerInterface $logger,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public static function getSubscribedEvents()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
SentMessageEvent::class => ['onSentMessage', 0],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onSentMessage(SentMessageEvent $event): void
|
||||||
|
{
|
||||||
|
$message = $event->getMessage();
|
||||||
|
|
||||||
|
$this->logger->warning('[sms] a sms was sent', ['validReceiversI' => $message->getOriginalMessage()->getRecipientId(), 'idsI' => $message->getMessageId()]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user