Exemplo n.º 1
0
 /**
  * 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;
     });
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 /**
  * 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);
 }
Exemplo n.º 4
0
 /**
  * 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;
     });
 }
Exemplo n.º 6
0
 /**
  * Set your release stage, eg "production" or "development"
  *
  * @param String $releaseStage the app's current release stage
  * @static 
  */
 public static function setReleaseStage($releaseStage)
 {
     return \Bugsnag_Client::setReleaseStage($releaseStage);
 }
Exemplo n.º 7
0
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
/*
|--------------------------------------------------------------------------
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
App::singleton('bugsnag', function () {
    $bugsnag = new Bugsnag_Client(Config::get('app.bugsnag_api_key'));
    $bugsnag->setReleaseStage(App::environment());
    return $bugsnag;
});
App::error(function ($exception) {
    App::make('bugsnag')->notifyException($exception, null, "error");
});
App::fatal(function ($exception) {
    App::make('bugsnag')->notifyException($exception, null, "error");
});
App::make('bugsnag')->setUser(['email' => Auth::check() ? Auth::user()->email : 'Guest user']);
App::make('bugsnag')->setBeforeNotifyFunction(function ($error) {
    $error->setMetaData(["user" => ["username" => Auth::check() ? Auth::user()->username : '******'], "metrics" => ["Metric 1" => "Some data here"]]);
});
require app_path() . '/filters.php';