luckyshopteam/

yii2-sentry

该包最新版本(2.0.3)没有可用的许可信息。

Yii2 sentry

2.0.3 2019-10-01 08:41 UTC

This package is auto-updated.

Last update: 2024-09-29 05:09:21 UTC


README

安装

composer require luckyshopteam/yii2-sentry @dev

连接

在应用组件中连接 SentryComponent 类

'components' => [
    'sentry' => [
        'class' => luckyshopteam\sentry\SentryComponent::class,
        'enabled' => true,
        'dsn' => getenv('SENTRY_DSN'),
        'environment' => YII_ENV, // if not set, the default is `production`
    ],
],

将 SentryTarget 类添加到 'log' 组件的 'targets' 参数中

'components' => [
    'log' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'flushInterval' => 1,
        'targets' => [
            [
                'class' => luckyshopteam\sentry\SentryTarget::class,
                'exportInterval' => 1,
                'levels' => ['error', 'warning'],
                'except' => [
                    'yii\web\HttpException:429', // TooManyRequestsHttpException
                    'yii\web\HttpException:401', // UnauthorizedHttpException
                ],
                'userData' => ['id', 'email', 'role'],
            ],
        ]
    ],
],