From e864d4643014eb64129741789999e441229fbfce Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 1 Dec 2021 13:33:10 +1100 Subject: [PATCH] Added some logging to SlackBotChannel::class --- src/Channels/SlackBotChannel.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Channels/SlackBotChannel.php b/src/Channels/SlackBotChannel.php index 0851398..6b1b3ef 100644 --- a/src/Channels/SlackBotChannel.php +++ b/src/Channels/SlackBotChannel.php @@ -3,10 +3,14 @@ namespace Slack\Channels; use Illuminate\Notifications\Notification; +use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Schema; class SlackBotChannel { - public function send($notifiable,Notification $notification) + private const LOGKEY = 'SBC'; + + public function send($notifiable,Notification $notification): void { if (! $co = $notifiable->routeNotificationFor('slackapp',$notification)) { return; @@ -15,6 +19,14 @@ class SlackBotChannel $o = $notification->toSlack($notifiable); $o->setChannel($co); - return $o->post(); + Log::debug(sprintf('%s:Sending Event to Channel [%s]',self::LOGKEY,$co->channel_id)); + + try { + $result = $o->post(); + + } catch (\Exception $e) { + Log::error(sprintf('Error posting to slack [%s]',$e->getMessage())); + return; + } } } \ No newline at end of file