Skip to content

Commit

Permalink
add logger specification support
Browse files Browse the repository at this point in the history
  • Loading branch information
klimov-paul committed May 10, 2024
1 parent db8bc07 commit 8ba2731
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8ba2731

Please sign in to comment.