Skip to content

Commit d61d679

Browse files
authored
Merge pull request #66 from DougSisk/laravel-5.4
Laravel 5.4 support
2 parents be232a8 + 684cc26 commit d61d679

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ before_script:
1515

1616
script:
1717
- mkdir -p build/logs
18-
- phpunit --coverage-clover build/logs/clover.xml
18+
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml
1919

2020
after_success:
2121
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php vendor/bin/coveralls -v; fi;'

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"require-dev": {
1919
"orchestra/testbench": "^3.0",
2020
"mockery/mockery": "^0.9",
21-
"satooshi/php-coveralls": "^1.0"
21+
"satooshi/php-coveralls": "^1.0",
22+
"phpunit/phpunit": "~4.0|~5.0"
2223
},
2324
"autoload": {
2425
"psr-4": {

src/RollbarServiceProvider.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,20 @@ public function boot()
2222
$app = $this->app;
2323

2424
// Listen to log messages.
25-
$app['log']->listen(function ($level, $message, $context) use ($app) {
25+
$app['log']->listen(function () use ($app) {
26+
$args = func_get_args();
27+
28+
// Laravel 5.4 returns a MessageLogged instance only
29+
if (count($args) == 1) {
30+
$level = $args[0]->level;
31+
$message = $args[0]->message;
32+
$context = $args[0]->context;
33+
} else {
34+
$level = $args[0];
35+
$message = $args[1];
36+
$context = $args[2];
37+
}
38+
2639
$app['Jenssegers\Rollbar\RollbarLogHandler']->log($level, $message, $context);
2740
});
2841
}
@@ -39,7 +52,7 @@ public function register()
3952

4053
$app = $this->app;
4154

42-
$this->app['RollbarNotifier'] = $this->app->share(function ($app) {
55+
$this->app->singleton('RollbarNotifier', function ($app) {
4356
// Default configuration.
4457
$defaults = [
4558
'environment' => $app->environment(),
@@ -59,7 +72,7 @@ public function register()
5972
return $rollbar;
6073
});
6174

62-
$this->app['Jenssegers\Rollbar\RollbarLogHandler'] = $this->app->share(function ($app) {
75+
$this->app->singleton('Jenssegers\Rollbar\RollbarLogHandler', function ($app) {
6376
$level = getenv('ROLLBAR_LEVEL') ?: $app['config']->get('services.rollbar.level', 'debug');
6477

6578
return new RollbarLogHandler($app['RollbarNotifier'], $app, $level);

0 commit comments

Comments
 (0)