https://github.com/holycheater/yii2-sentry
Sentry error handler
https://github.com/holycheater/yii2-sentry
sentry-error-handler yii2 yii2-extension
Last synced: 5 months ago
JSON representation
Sentry error handler
- Host: GitHub
- URL: https://github.com/holycheater/yii2-sentry
- Owner: holycheater
- Created: 2016-05-26T21:34:13.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-01-19T14:49:22.000Z (over 8 years ago)
- Last Synced: 2025-02-16T20:28:55.578Z (over 1 year ago)
- Topics: sentry-error-handler, yii2, yii2-extension
- Language: PHP
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Yii2 Sentry error handler
=========================
Config
-----
```php
'components' => [
'sentry' => [
'class' => 'alexsalt\sentry\Client',
'dsn' => '',
'options' => [
'exclude' => [
'yii\\web\\NotFoundHttpException',
'yii\\web\\ForbiddenHttpException',
'yii\\web\\UnauthorizedHttpException',
'yii\\base\\InvalidRouteException',
],
],
],
'errorHandler' => [
'class' => 'alexsalt\sentry\ConsoleErrorHandler',
],
'log' => [
'targets' => [
[
'class' => 'alexsalt\\sentry\\LogTarget',
'levels' => [ 'warning', 'error' ],
],
],
],
]
```
Use `alexsalt\sentry\WebErrorHandler` for web apps
Logging
-------
```php
// basic
Yii::error('message');
// extra data
Yii::error([
'msg' => 'message name',
'data' => [
'foo' => 'bar',
],
]);
// capture exception
try {
throw new \Exception('test');
} catch (\Exception $e) {
Yii::$app->errorHandler->logException($e);
}
```