Update v1.0.6

This commit is contained in:
Bhanu Slathia
2016-02-16 23:24:52 +05:30
parent c710c20b9e
commit b1f62846ab
7662 changed files with 1361647 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php namespace Bugsnag\BugsnagLaravel;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class BugsnagExceptionHandler extends ExceptionHandler {
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
foreach ($this->dontReport as $type) {
if ($e instanceof $type) {
return parent::report($e);
}
}
if (app()->bound('bugsnag')) {
app('bugsnag')->notifyException($e, null, "error");
}
return parent::report($e);
}
}

View File

@@ -0,0 +1,11 @@
<?php namespace Bugsnag\BugsnagLaravel;
use Illuminate\Support\Facades\Facade;
class BugsnagFacade extends Facade
{
protected static function getFacadeAccessor()
{
return 'bugsnag';
}
}

View File

@@ -0,0 +1,115 @@
<?php namespace Bugsnag\BugsnagLaravel;
use Illuminate\Support\ServiceProvider;
class BugsnagLaravelServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$app = $this->app;
if (version_compare($app::VERSION, '5.0') < 0) {
$this->package('bugsnag/bugsnag-laravel', 'bugsnag');
// Register for exception handling
$app->error(function (\Exception $exception) use ($app) {
if ('Symfony\Component\Debug\Exception\FatalErrorException'
!== get_class($exception)
) {
$app['bugsnag']->notifyException($exception, null, "error");
}
});
// Register for fatal error handling
$app->fatal(function ($exception) use ($app) {
$app['bugsnag']->notifyException($exception, null, "error");
});
} else {
$this->publishes(array(
__DIR__.'/config.php' => config_path('bugsnag.php'),
));
}
}
/**
* 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.3',
'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']);
}
// 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;
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array("bugsnag");
}
}

View File

@@ -0,0 +1,91 @@
<?php namespace Bugsnag\BugsnagLaravel;
use Illuminate\Support\ServiceProvider;
class BugsnagLumenServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->app->configure('bugsnag');
}
/**
* 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(false);
$client->setReleaseStage($app->environment());
$client->setNotifier(array(
'name' => 'Bugsnag Lumen',
'version' => '1.6.3',
'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']);
}
// 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;
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array("bugsnag");
}
}

View File

@@ -0,0 +1,77 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| API Key
|--------------------------------------------------------------------------
|
| You can find your API key on your Bugsnag dashboard.
|
| This api key points the Bugsnag notifier to the project in your account
| which should receive your application's uncaught exceptions.
|
*/
'api_key' => env('BUGSNAG_API_KEY'),
/*
|--------------------------------------------------------------------------
| Notify Release Stages
|--------------------------------------------------------------------------
|
| Set which release stages should send notifications to Bugsnag.
|
| Example: array('development', 'production')
|
*/
'notify_release_stages' => env('BUGSNAG_NOTIFY_RELEASE_STAGES', null),
/*
|--------------------------------------------------------------------------
| Endpoint
|--------------------------------------------------------------------------
|
| Set what server the Bugsnag notifier should send errors to. By default
| this is set to 'https://notify.bugsnag.com', but for Bugsnag Enterprise
| this should be the URL to your Bugsnag instance.
|
*/
'endpoint' => env('BUGSNAG_ENDPOINT', null),
/*
|--------------------------------------------------------------------------
| Filters
|--------------------------------------------------------------------------
|
| Use this if you want to ensure you don't send sensitive data such as
| passwords, and credit card numbers to our servers. Any keys which
| contain these strings will be filtered.
|
*/
'filters' => env('BUGSNAG_FILTERS', array('password')),
/*
|--------------------------------------------------------------------------
| Proxy
|--------------------------------------------------------------------------
|
| If your server is behind a proxy server, you can configure this as well.
| Other than the host, none of these settings are mandatory.
|
| Note: Proxy configuration is only possible if the PHP cURL extension
| is installed.
|
| Example:
|
| 'proxy' => array(
| 'host' => 'bugsnag.com',
| 'port' => 42,
| 'user' => 'username',
| 'password' => 'password123'
| )
|
*/
'proxy' => env('BUGSNAG_PROXY', null)
);

View File

@@ -0,0 +1,77 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| API Key
|--------------------------------------------------------------------------
|
| You can find your API key on your Bugsnag dashboard.
|
| This api key points the Bugsnag notifier to the project in your account
| which should receive your application's uncaught exceptions.
|
*/
'api_key' => 'YOUR-API-KEY-HERE',
/*
|--------------------------------------------------------------------------
| Notify Release Stages
|--------------------------------------------------------------------------
|
| Set which release stages should send notifications to Bugsnag.
|
| Example: array('development', 'production')
|
*/
'notify_release_stages' => null,
/*
|--------------------------------------------------------------------------
| Endpoint
|--------------------------------------------------------------------------
|
| Set what server the Bugsnag notifier should send errors to. By default
| this is set to 'https://notify.bugsnag.com', but for Bugsnag Enterprise
| this should be the URL to your Bugsnag instance.
|
*/
'endpoint' => null,
/*
|--------------------------------------------------------------------------
| Filters
|--------------------------------------------------------------------------
|
| Use this if you want to ensure you don't send sensitive data such as
| passwords, and credit card numbers to our servers. Any keys which
| contain these strings will be filtered.
|
*/
'filters' => array('password'),
/*
|--------------------------------------------------------------------------
| Proxy
|--------------------------------------------------------------------------
|
| If your server is behind a proxy server, you can configure this as well.
| Other than the host, none of these settings are mandatory.
|
| Note: Proxy configuration is only possible if the PHP cURL extension
| is installed.
|
| Example:
|
| 'proxy' => array(
| 'host' => 'bugsnag.com',
| 'port' => 42,
| 'user' => 'username',
| 'password' => 'password123'
| )
|
*/
'proxy' => null
);