From 8ba27315bf6d71667dd10ddedfaed61128996472 Mon Sep 17 00:00:00 2001 From: Paul Klimov Date: Fri, 10 May 2024 13:32:32 +0300 Subject: [PATCH] add logger specification support --- src/Mailer.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Mailer.php b/src/Mailer.php index 3ec6cd9..74149d7 100644 --- a/src/Mailer.php +++ b/src/Mailer.php @@ -81,6 +81,12 @@ class Mailer extends CApplicationComponent */ public $defaultHeaders = []; + /** + * @var \Psr\Log\LoggerInterface|null PSR logger to be applied to the mail transport. + * @see https://github.com/yii1tech/psr-log + */ + public $logger; + /** * @var \Symfony\Component\Mailer\Mailer Symfony mailer instance. */ @@ -182,9 +188,9 @@ public function getTransport(): TransportInterface } if ($this->dsn === 'array://') { - $this->_transport = new ArrayTransport(); + $this->_transport = new ArrayTransport(null, $this->logger); } else { - $this->_transport = Transport::fromDsn($this->dsn); + $this->_transport = Transport::fromDsn($this->dsn, null, null, $this->logger); } return $this->_transport;