public function register()
{
$this->app->singleton('bugsnag', function (Container $app) {
$config = $app->config->get('bugsnag');
$client = new Client(new Configuration($config['api_key']), new LaravelResolver($app), $this->getGuzzle($config));
$this->setupCallbacks($client, $app, $config);
$this->setupPaths($client, $app->basePath(), $app->path(), isset($config['strip_path']) ? $config['strip_path'] : null, isset($config['project_root']) ? $config['project_root'] : null);
$client->setReleaseStage($app->environment() ?: 'production');
$client->setHostname(isset($config['hostname']) ? $config['hostname'] : null);
$client->setFallbackType($app->runningInConsole() ? 'Console' : 'HTTP');
$client->setAppType(isset($config['app_type']) ? $config['app_type'] : null);
$client->setAppVersion(isset($config['app_version']) ? $config['app_version'] : null);
$client->setBatchSending(isset($config['batch_sending']) ? $config['batch_sending'] : true);
$client->setSendCode(isset($config['send_code']) ? $config['send_code'] : true);
$client->setNotifier(['name' => 'Bugsnag Laravel', 'version' => static::VERSION, 'url' => 'https://github.com/bugsnag/bugsnag-laravel']);
if (isset($config['notify_release_stages']) && is_array($config['notify_release_stages'])) {
$client->setNotifyReleaseStages($config['notify_release_stages']);
}
if (isset($config['filters']) && is_array($config['filters'])) {
$client->setFilters($config['filters']);
}
return $client;
});
$this->app->singleton('bugsnag.tracker', function () {
return new Tracker();
});
$this->app->singleton('bugsnag.logger', function (Container $app) {
return new LaravelLogger($app['bugsnag']);
});
$this->app->singleton('bugsnag.multi', function (Container $app) {
return new MultiLogger([$app['log'], $app['bugsnag.logger']]);
});
$this->app->alias('bugsnag', Client::class);
$this->app->alias('bugsnag.tracker', Tracker::class);
$this->app->alias('bugsnag.logger', LaravelLogger::class);
$this->app->alias('bugsnag.multi', MultiLogger::class);
}