<?php
namespace Bodymed\Webshop\Core\Subscriber;
use Psr\Log\LoggerInterface;
use Shopware\Core\Content\MailTemplate\Service\Event\MailErrorEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class LoggerSubscriber implements EventSubscriberInterface
{
private LoggerInterface $logger;
/**
* @param LoggerInterface $logger
*/
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
public static function getSubscribedEvents(): array
{
return [
MailErrorEvent::class => 'onMailErrorEvent',
];
}
public function onMailErrorEvent(MailErrorEvent $errorEvent): void
{
$this->logger->log($errorEvent->getLogLevel(), $errorEvent->getMessage(), $errorEvent->getLogData());
}
}