Ejemplo n.º 1
0
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->publishes([__DIR__ . '/config/config.php' => config_path('raven.php')], 'config');
     if (!config('raven.enabled')) {
         return;
     }
     $this->app['log']->registerHandler(config('raven.level', 'error'), function ($level) {
         $handler = new RavenHandler($this->app[Client::class], $level);
         // Add processors
         $processors = config('raven.monolog.processors', []);
         if (is_array($processors)) {
             foreach ($processors as $process) {
                 // Get callable
                 if (is_callable($process)) {
                     $callable = $process;
                 } elseif (is_string($process)) {
                     $callable = new $process();
                 } else {
                     throw new \Exception('Raven: Invalid processor');
                 }
                 // Add processor to Raven handler
                 $handler->pushProcessor($callable);
             }
         }
         return $handler;
     });
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     if (!$this->app->config->get('raven::enabled')) {
         return;
     }
     $this->app->log = new Log($this->app->log->getMonolog());
     $this->app->log->registerHandler($this->app->config->get('raven::level', 'error'), function ($level) {
         $handler = new RavenHandler($this->app['log.raven'], $level);
         // Add processors
         $processors = $this->app['log.raven.processors'];
         if (is_array($processors)) {
             foreach ($processors as $process) {
                 // Get callable
                 if (is_string($process)) {
                     $callable = new $process();
                 } elseif (is_callable($process)) {
                     $callable = $process;
                 } else {
                     throw new InvalidArgumentException('Raven: Invalid processor');
                 }
                 // Add processor to Raven handler
                 $handler->pushProcessor($callable);
             }
         }
         return $handler;
     });
 }