/** * 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; }); }
/** * @return Bugsnag_Client */ public static function getBugsnag() { static $bugsnag = null; if (null === $bugsnag) { $bugsnag = new \Bugsnag_Client(Configure::read('BugsnagCakephp.apikey')); $bugsnag->setBatchSending(false); $bugsnag->setNotifier(array('name' => 'Bugsnag CakePHP', 'version' => '0.1.0', 'url' => 'https://github.com/Label305/bugsnag-cakephp')); } return $bugsnag; }
public static function createClient($options = array()) { $bugsnag = new \Bugsnag_Client(Configure::read('BugsnagCakephp.apikey')); $bugsnag->setBatchSending(false); $bugsnag->setNotifier(array('name' => 'Bugsnag CakePHP', 'version' => '0.1.0', 'url' => 'https://github.com/Label305/bugsnag-cakephp')); $bugsnag->setReleaseStage(Configure::read('BugsnagCakephp.releaseStage')); $bugsnag->setNotifyReleaseStages(Configure::read('BugsnagCakephp.notifyReleaseStages')); $bugsnag->setType("CakePHP"); $filters = Configure::read('BugsnagCakephp.filters'); if (!empty($filters)) { $bugsnag->setFilters($filters); } return $bugsnag; }
/** * 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; }); }
/** * Sets whether errors should be batched together and send at the end of * each request. * * @param Boolean $batchSending whether to batch together errors * @static */ public static function setBatchSending($batchSending) { return \Bugsnag_Client::setBatchSending($batchSending); }