Skip to content

Commit b17163e

Browse files
authored
Merge pull request #20 from guanguans/issue-19-Job错误
2 parents a0b1f97 + 59e299b commit b17163e

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

config/exception-notify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
// Log
213213
'log' => [
214214
'driver' => 'log',
215-
'channel' => env('EXCEPTION_NOTIFY_LOG_CHANNEL', config('logging.default')),
215+
'channel' => env('EXCEPTION_NOTIFY_LOG_CHANNEL', config('logging.default', 'stack')),
216216
'level' => env('EXCEPTION_NOTIFY_LOG_LEVEL', 'error'),
217217
'pipeline' => [],
218218
],

src/ExceptionNotifyManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public function report(Throwable $e)
7474
}
7575

7676
$this->registerException($e);
77-
$this->registerReportExceptionJobMethod();
7877
$this->dispatchReportExceptionJob();
7978
} catch (Throwable $e) {
8079
$this->container['log']->error($e->getMessage(), ['exception' => $e]);
@@ -100,9 +99,10 @@ function (ShouldQueue $job, Container $container) {
10099

101100
protected function dispatchReportExceptionJob()
102101
{
102+
$report = (string) $this->container->make(CollectorManager::class);
103103
$drivers = $this->getDrivers() ?: Arr::wrap($this->driver());
104104
foreach ($drivers as $driver) {
105-
$dispatch = dispatch(ReportExceptionJob::create($driver));
105+
$dispatch = dispatch(ReportExceptionJob::create($driver, $report));
106106

107107
'sync' === $this->container['config']['queue.default'] and
108108
method_exists($dispatch, 'afterResponse') and $dispatch->afterResponse();

src/Jobs/ReportExceptionJob.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,20 @@ class ReportExceptionJob implements ShouldQueue
5656
*/
5757
protected $channel;
5858

59-
public function __construct(Channel $channel)
59+
/**
60+
* @var string
61+
*/
62+
protected $report;
63+
64+
public function __construct(Channel $channel, string $report)
6065
{
6166
$this->channel = $channel;
67+
$this->report = $report;
6268
}
6369

64-
public function handle(string $report)
70+
public function handle()
6571
{
66-
$pipedReport = $this->pipelineReport($report);
72+
$pipedReport = $this->pipelineReport($this->report);
6773

6874
$this->fireReportingEvent($pipedReport);
6975
$result = $this->channel->report($pipedReport);

0 commit comments

Comments
 (0)