diff --git a/CHANGELOG.md b/CHANGELOG.md index 714fa19..c8cd9df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to `laravel-log-mailer` will be documented in this file +## 1.0.2 - 2018-09-09 +- fix logging levels + ## 1.0.1 - 2018-09-05 - fix dependancy diff --git a/src/Logging/Driver/MailableLogger.php b/src/Logging/Driver/MailableLogger.php index 0ea7127..a31008e 100644 --- a/src/Logging/Driver/MailableLogger.php +++ b/src/Logging/Driver/MailableLogger.php @@ -24,7 +24,9 @@ public function __invoke(array $config) $mailHandler = new MailableHandler( $this->buildMailable(), - $this->subjectFormatter() + $this->subjectFormatter(), + $this->config('level'), + $this->config('bubble') ); $mailHandler->setFormatter(new HtmlFormatter()); diff --git a/src/Logging/Monolog/Handlers/MailableHandler.php b/src/Logging/Monolog/Handlers/MailableHandler.php index 3b96225..d6c1de1 100644 --- a/src/Logging/Monolog/Handlers/MailableHandler.php +++ b/src/Logging/Monolog/Handlers/MailableHandler.php @@ -5,6 +5,7 @@ use Illuminate\Mail\Mailable; use Monolog\Formatter\LineFormatter; use Monolog\Handler\MailHandler; +use Monolog\Logger; class MailableHandler extends MailHandler { @@ -13,11 +14,14 @@ class MailableHandler extends MailHandler * * @param Mailable $mailable * @param LineFormatter $subjectFormatter + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * * @return void */ - public function __construct(Mailable $mailable, LineFormatter $subjectFormatter) + public function __construct(Mailable $mailable, LineFormatter $subjectFormatter, $level = Logger::DEBUG, $bubble = true) { + parent::__construct($level, $bubble); $this->mailer = app()->make('mailer'); $this->subjectFormatter = $subjectFormatter; $this->mailable = $mailable;