/** * Register the service provider. * * @return void */ public function register() { $this->app->singleton('bugsnag', function ($app) { $config = isset($app['config']['services']['bugsnag']) ? $app['config']['services']['bugsnag'] : null; if (is_null($config)) { $config = $app['config']['bugsnag'] ?: $app['config']['bugsnag::config']; } $client = new \Bugsnag_Client($config['api_key']); $client->setStripPath(base_path()); $client->setProjectRoot(base_path() . '/app'); $client->setAutoNotify(false); $client->setBatchSending(true); $client->setReleaseStage($app->environment()); $client->setNotifier(array('name' => 'Bugsnag Lumen', 'version' => '1.6.4', '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['endpoint'])) { $client->setEndpoint($config['endpoint']); } if (isset($config['filters']) && is_array($config['filters'])) { $client->setFilters($config['filters']); } if (isset($config['proxy']) && is_array($config['proxy'])) { $client->setProxySettings($config['proxy']); } return $client; }); }
/** * Register the bugsnag class. * * @return void */ protected function registerBugsnag() { $this->app->singleton('bugsnag', function (Container $app) { $bugsnag = new Bugsnag($app->config->get('bugsnag.key')); $bugsnag->setStripPath($app->basePath()); $bugsnag->setProjectRoot($app->path()); $bugsnag->setAutoNotify(false); $bugsnag->setBatchSending(false); $bugsnag->setReleaseStage($app->environment()); $bugsnag->setNotifier(['name' => 'Alt Three Bugsnag PHP', 'version' => '1', 'url' => 'https://alt-three.com']); return $bugsnag; }); $this->app->alias('bugsnag', Bugsnag::class); }
/** * Register the bugsnag class. * * @return void */ protected function registerBugsnag() { $this->app->singleton('bugsnag', function ($app) { $bugsnag = new Bugsnag($app->config->get('bugsnag.key')); $bugsnag->setStripPath($app['path.base']); $bugsnag->setProjectRoot($app['path']); $bugsnag->setAutoNotify(false); $bugsnag->setBatchSending(false); $bugsnag->setReleaseStage($app->environment()); if ($app->auth->check()) { $bugsnag->setUser(['id' => $app->auth->user()->getAuthIdentifier()]); } return $bugsnag; }); $this->app->alias('bugsnag', Bugsnag::class); }
/** * Register the service provider. * * @return void */ public function register() { $this->app->singleton('bugsnag', function ($app) { $config = isset($app['config']['services']['bugsnag']) ? $app['config']['services']['bugsnag'] : null; if (is_null($config)) { $config = $app['config']['bugsnag'] ?: $app['config']['bugsnag::config']; } $client = new \Bugsnag_Client($config['api_key']); $client->setStripPath(base_path()); $client->setProjectRoot(app_path()); $client->setAutoNotify(false); $client->setBatchSending(false); $client->setReleaseStage($app->environment()); $client->setNotifier(array('name' => 'Bugsnag Laravel', 'version' => '1.6.2', '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['endpoint'])) { $client->setEndpoint($config['endpoint']); } if (isset($config['filters']) && is_array($config['filters'])) { $client->setFilters($config['filters']); } if (isset($config['proxy']) && is_array($config['proxy'])) { $client->setProxySettings($config['proxy']); } if (isset($config['app_version'])) { $client->setAppVersion($config['app_version']); } // Check if someone is logged in. try { if ($app['auth']->check()) { // User is logged in. $user = $app['auth']->user(); // If these attributes are available: pass them on. $client->setUser(array('id' => $user->getAuthIdentifier())); } } catch (\Exception $e) { // Do nothing. } return $client; }); }
/** * Set the path that should be stripped from the beginning of * any stacktrace file line. This helps to normalise filenames * for grouping and reduces the noise in stack traces. * * @param String $stripPath the path to strip from filenames * @static */ public static function setStripPath($stripPath) { return \Bugsnag_Client::setStripPath($stripPath); }