From a4b1c36d9d172a1cd602117975bd5c3a4aea4ad8 Mon Sep 17 00:00:00 2001 From: Steve Porter Date: Sun, 9 Sep 2018 08:24:09 +0100 Subject: [PATCH 1/3] fix: fix logging levels --- src/Logging/Driver/MailableLogger.php | 4 +++- src/Logging/Monolog/Handlers/MailableHandler.php | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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..f0b7d2b 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 Boolean $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; From 24d3ccf0d839e4051ba6fb2ac1afdadf6c7b9e01 Mon Sep 17 00:00:00 2001 From: Steve Porter Date: Sun, 9 Sep 2018 07:25:06 +0000 Subject: [PATCH 2/3] Apply fixes from StyleCI --- src/Logging/Monolog/Handlers/MailableHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Logging/Monolog/Handlers/MailableHandler.php b/src/Logging/Monolog/Handlers/MailableHandler.php index f0b7d2b..d6c1de1 100644 --- a/src/Logging/Monolog/Handlers/MailableHandler.php +++ b/src/Logging/Monolog/Handlers/MailableHandler.php @@ -15,7 +15,7 @@ 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 Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * * @return void */ From 8962aa153ccc6397ccc27dd9500dfca21e6f113c Mon Sep 17 00:00:00 2001 From: Steve Porter Date: Sun, 9 Sep 2018 08:45:16 +0100 Subject: [PATCH 3/3] doc: changelog update --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) 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