Skip to content

Commit

Permalink
Add logger notify level to Laravel configuration (#265)
Browse files Browse the repository at this point in the history
* Added configuration option for log level

* Apply fixes from StyleCI (#264)
  • Loading branch information
Cawllec authored Dec 14, 2017
1 parent b5f23d2 commit ceb2487
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
14 changes: 14 additions & 0 deletions config/bugsnag.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,18 @@

'user' => env('BUGSNAG_USER', true),

/*
|--------------------------------------------------------------------------
| Logger Notify Level
|--------------------------------------------------------------------------
|
| This sets the level at which a logged message will trigger a notification
| to Bugsnag. By default this level will be 'notice'.
|
| Must be one of the Psr\Log\LogLevel levels from the Psr specification.
|
*/

'logger_notify_level' => env('BUGSNAG_LOGGER_LEVEL'),

];
8 changes: 7 additions & 1 deletion src/BugsnagServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,13 @@ public function register()
});

$this->app->singleton('bugsnag.logger', function (Container $app) {
return new LaravelLogger($app['bugsnag'], $app['events']);
$config = $app->config->get('bugsnag');
$logger = new LaravelLogger($app['bugsnag'], $app['events']);
if (isset($config['logger_notify_level'])) {
$logger->setNotifyLevel($config['logger_notify_level']);
}

return $logger;
});

$this->app->singleton('bugsnag.multi', function (Container $app) {
Expand Down

0 comments on commit ceb2487

Please sign in to comment.