public function enable($apiKey, $projectId, $ignoredExceptions = [], $env = null, $version = null, $host = null) { $args = ['projectKey' => $apiKey, 'projectId' => $projectId]; if ($host !== null) { $args['host'] = $host; } if ($env !== null) { $args['environment'] = $env; } if ($version !== null) { $args['appVersion'] = $version; } $this->client = new Notifier($args); $this->client->addFilter(function ($notice) use($ignoredExceptions) { if (in_array($notice['errors'][0]['type'], $ignoredExceptions)) { return null; } return $notice; }); }
/** * Register the application services. * * @return void */ public function register() { $this->app->singleton('Airbrake\\Instance', function ($app) { $airbrake = new Notifier(['projectId' => config('airbrake.id'), 'projectKey' => config('airbrake.key'), 'host' => config('airbrake.host')]); $airbrake->addFilter(function ($notice) { $this->setEnvName($notice); foreach ($this->getEnvKeys() as $envKey) { $this->filterEnvKey($notice, $envKey); } return $notice; }); return $airbrake; }); $handler = $this->app->make('Illuminate\\Contracts\\Debug\\ExceptionHandler'); $this->app->instance('Illuminate\\Contracts\\Debug\\ExceptionHandler', new Handler\AirbrakeExceptionHandler($handler, $this->app)); }