Added some logging to SlackBotChannel::class
This commit is contained in:
parent
edfb802805
commit
e864d46430
@ -3,10 +3,14 @@
|
|||||||
namespace Slack\Channels;
|
namespace Slack\Channels;
|
||||||
|
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class SlackBotChannel
|
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)) {
|
if (! $co = $notifiable->routeNotificationFor('slackapp',$notification)) {
|
||||||
return;
|
return;
|
||||||
@ -15,6 +19,14 @@ class SlackBotChannel
|
|||||||
$o = $notification->toSlack($notifiable);
|
$o = $notification->toSlack($notifiable);
|
||||||
$o->setChannel($co);
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user