From 7e75343495af6ef5f4b0256f307977c7b69368da Mon Sep 17 00:00:00 2001 From: formsdev <136701234+formsdev@users.noreply.github.com> Date: Thu, 10 Aug 2023 20:19:36 +0530 Subject: [PATCH] If slack log url not set then not log to slack (#166) --- app/Exceptions/Handler.php | 2 +- config/logging.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 0dc6d7b..830207d 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -70,7 +70,7 @@ class Handler extends ExceptionHandler public function render($request, Throwable $e) { - if ($this->shouldReport($e) && !in_array(\App::environment(),['testing'])) { + if ($this->shouldReport($e) && !in_array(\App::environment(),['testing']) && config('logging.channels.slack.enabled')) { Log::channel('slack')->error($e); } diff --git a/config/logging.php b/config/logging.php index a4912a9..0a97d16 100644 --- a/config/logging.php +++ b/config/logging.php @@ -55,6 +55,7 @@ return [ ], 'slack' => [ + 'enabled' => env('LOG_SLACK_WEBHOOK_URL') ? true : false, 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'OpenForm Log',