added sentry and bugsnag

This commit is contained in:
Denis Duliçi
2022-10-17 14:19:42 +03:00
parent 79dc3891a3
commit 350d189ea9
7 changed files with 1455 additions and 57 deletions

View File

@ -48,6 +48,40 @@ class Handler extends ExceptionHandler
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
if (config('logging.default') == 'sentry') {
app('sentry')->configureScope(function ($scope) {
$scope->setTag('company_id', (string) company_id());
$scope->setTag('locale', (string) app()->getLocale());
$scope->setTag('timezone', (string) config('app.timezone'));
});
//define('SENTRY_RELEASE', version('short'));
}
if (config('logging.default') == 'bugsnag') {
app('bugsnag')->registerCallback(function ($report) {
$report->setMetaData([
'akaunting' => [
'company_id' => (string) company_id(),
'locale' => (string) app()->getLocale(),
'timezone' => (string) config('app.timezone'),
]
]);
});
app('bugsnag')->setAppVersion(version('short'));
}
});
}
/**
* Report or log an exception.
*