-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathLogChannel.php
More file actions
30 lines (25 loc) · 963 Bytes
/
LogChannel.php
File metadata and controls
30 lines (25 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php declare(strict_types=1);
namespace App\Notifier\Channel;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Symfony\Component\Notifier\Channel\ChannelInterface;
use Symfony\Component\Notifier\Notification\Notification;
use Symfony\Component\Notifier\Recipient\RecipientInterface;
class LogChannel implements ChannelInterface, LoggerAwareInterface
{
use LoggerAwareTrait;
public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void
{
if (isset($this->logger)) {
$this->logger->info($notification->getSubject(), [
'class' => $notification::class,
'importance' => $notification->getImportance(),
'content' => $notification->getContent(),
]);
}
}
public function supports(Notification $notification, RecipientInterface $recipient): bool
{
return true;
}
}