Ejemplo n.º 1
0
 /**
  * Log a message to the logs.
  *
  * @param string $level
  * @param mixed  $message
  * @param array  $context
  *
  * @return void
  */
 public function log($level, $message, array $context = [])
 {
     $severity = $this->getSeverity($level);
     $this->bugsnag->setUser($this->resolveCurrentUser());
     if ($message instanceof Exception) {
         $this->bugsnag->notifyException($message, array_except($context, ['title']), $severity);
     } else {
         $msg = $this->formatMessage($message);
         $title = array_get($context, 'title', str_limit((string) $msg));
         $this->bugsnag->notifyError($title, $msg, array_except($context, ['title']), $severity);
     }
 }
 public function register($app)
 {
     /**
      * Bugsnag Register 4bb0c217d0b9cfac312f9d6341b95bff
      */
     $bugsnag = new \Bugsnag_Client("4bb0c217d0b9cfac312f9d6341b95bff");
     $bugsnag->setUser(array('name' => 'RE Damaal', 'email' => '*****@*****.**'));
     set_error_handler(array($bugsnag, "errorHandler"));
     set_exception_handler(array($bugsnag, "exceptionHandler"));
 }
Ejemplo n.º 3
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;
     });
 }
Ejemplo n.º 5
0
 /**
  * Set information about the current user of your app, including
  * id, name and email.
  *
  * @param Array $user an array of user information. Eg:
  *        array(
  *            'name' => 'Bob Hoskins',
  *            'email' => '*****@*****.**'
  *        )
  * @static 
  */
 public static function setUser($user)
 {
     return \Bugsnag_Client::setUser($user);
 }