Skip to content

Commit

Permalink
refactor(config): update default reported channels
Browse files Browse the repository at this point in the history
- Updated the 'defaults' array in the 'exception-notify.php' config file.
- Commented out some channels and added 'log' as the default reported channel.
  • Loading branch information
guanguans committed Aug 8, 2023
1 parent 6645071 commit 2c5e46a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
21 changes: 19 additions & 2 deletions config/exception-notify.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,26 @@
],

/**
* The default channel.
* The default reported channels.
*/
'default' => env('EXCEPTION_NOTIFY_CHANNEL', 'log'),
'defaults' => [
// 'bark',
// 'chanify',
// 'dingTalk',
// 'discord',
// 'dump',
// 'feiShu',
'log',
// 'mail',
// 'null',
// 'pushDeer',
// 'qqChannelBot',
// 'serverChan',
// 'slack',
// 'telegram',
// 'weWork',
// 'xiZhi',
],

/**
* The list of channels.
Expand Down
4 changes: 2 additions & 2 deletions src/ExceptionNotifyManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function report(\Throwable $throwable, $channels = null): void
}

$dispatch = dispatch(new ReportExceptionJob(app(CollectorManager::class)->mapToReports(
(array) ($channels ?? $this->getDefaultDriver()),
(array) ($channels ?? config('exception-notify.defaults')),
$throwable
)));

Expand All @@ -104,7 +104,7 @@ public function report(\Throwable $throwable, $channels = null): void

public function getDefaultDriver()
{
return config('exception-notify.default');
return Arr::first(config('exception-notify.defaults'));
}

/**
Expand Down

0 comments on commit 2c5e46a

Please sign in to comment.