Skip to content

Commit e0da896

Browse files
committed
Merge branch 'master' into feat-listen-queue-events
# Conflicts: # src/Sentry/SentryLaravel/SentryLaravelEventHandler.php
2 parents 6fdeaa0 + e637d0e commit e0da896

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/Sentry/SentryLaravel/SentryLaravelEventHandler.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use Illuminate\Routing\Events\RouteMatched;
1313
use Illuminate\Contracts\Events\Dispatcher;
1414
use Illuminate\Database\Events\QueryExecuted;
15+
use Illuminate\Console\Events\CommandStarting;
16+
use Illuminate\Console\Events\CommandFinished;
1517

1618
class SentryLaravelEventHandler
1719
{
@@ -32,6 +34,9 @@ class SentryLaravelEventHandler
3234

3335
'Illuminate\Queue\Events\JobProcessed' => 'queueJobProcessed', // since Laravel 5.2
3436
'Illuminate\Queue\Events\JobProcessing' => 'queueJobProcessing', // since Laravel 5.2
37+
38+
'Illuminate\Console\Events\CommandStarting' => 'commandStarting', // Since Laravel 5.5
39+
'Illuminate\Console\Events\CommandFinished' => 'commandFinished', // Since Laravel 5.5
3540
);
3641

3742
/**
@@ -277,4 +282,28 @@ protected function queueJobProcessingHandler(JobProcessing $event)
277282
'data' => $job,
278283
]);
279284
}
285+
286+
/**
287+
* Since Laravel 5.5
288+
*
289+
* @param \Illuminate\Console\Events\CommandStarting $event
290+
*/
291+
protected function commandStartingHandler(CommandStarting $event)
292+
{
293+
$this->client->tags_context(array(
294+
'command' => $event->command,
295+
));
296+
}
297+
298+
/**
299+
* Since Laravel 5.5
300+
*
301+
* @param \Illuminate\Console\Events\CommandFinished $event
302+
*/
303+
protected function commandFinishedHandler(CommandFinished $event)
304+
{
305+
$this->client->tags_context(array(
306+
'command' => null,
307+
));
308+
}
280309
}

0 commit comments

Comments
 (0)