mirror of
https://github.com/flarum/framework.git
synced 2025-02-26 21:55:41 +08:00
LogDriver should work in debug mode
This commit is contained in:
parent
52896144e1
commit
ae5bfcc7ec
28
framework/core/src/Mail/FlarumLogTransport.php
Normal file
28
framework/core/src/Mail/FlarumLogTransport.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Flarum\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Mail\Transport\LogTransport;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Swift_Mime_SimpleMessage;
|
||||||
|
use Swift_Mime_SimpleMimeEntity;
|
||||||
|
|
||||||
|
class FlarumLogTransport extends LogTransport
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
|
||||||
|
{
|
||||||
|
$this->beforeSendPerformed($message);
|
||||||
|
|
||||||
|
// Overriden to use info, so the log driver works in non-debug mode.
|
||||||
|
$this->logger->info($this->getMimeEntityString($message));
|
||||||
|
|
||||||
|
$this->sendPerformed($message);
|
||||||
|
|
||||||
|
return $this->numberOfRecipients($message);
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,6 @@ namespace Flarum\Mail;
|
|||||||
|
|
||||||
use Flarum\Settings\SettingsRepositoryInterface;
|
use Flarum\Settings\SettingsRepositoryInterface;
|
||||||
use Illuminate\Contracts\Validation\Factory;
|
use Illuminate\Contracts\Validation\Factory;
|
||||||
use Illuminate\Mail\Transport\LogTransport;
|
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Swift_Transport;
|
use Swift_Transport;
|
||||||
@ -45,6 +44,6 @@ class LogDriver implements DriverInterface
|
|||||||
|
|
||||||
public function buildTransport(SettingsRepositoryInterface $settings): Swift_Transport
|
public function buildTransport(SettingsRepositoryInterface $settings): Swift_Transport
|
||||||
{
|
{
|
||||||
return new LogTransport($this->logger);
|
return new FlarumLogTransport($this->logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user