born05 / craft-sentry
将Craft CMS错误推送到Sentry。
3.0.0
2024-06-13 12:44 UTC
Requires
- php: ^8.0.2
- craftcms/cms: ^4.0.0-alpha|^5.0.0-beta.1
- sentry/sdk: ^4.0.0
README
将Craft CMS错误推送到Sentry。
安装
插件商店
- 搜索'Sentry SDK'。
- 点击安装
- 按照以下说明创建一个配置文件。
Composer
- 运行:
composer require born05/craft-sentry
- 在管理 > 设置 > 插件中点击安装
- 按照以下说明创建一个配置文件。
要求
- Craft 4.0.0及更高版本
- PHP 8.0.2及更高版本
配置Sentry
创建一个config/sentry-sdk.php
配置文件,内容如下
<?php return [ '*' => [ 'enabled' => true, 'anonymous' => false, // Determines to log user info or not 'clientDsn' => getenv('SENTRY_DSN') ?: 'https://example@sentry.io/123456789', // Set as string or use environment variable. 'clientKey' => getenv('SENTRY_CLIENT_KEY') ?: 'z987654321a', // https://js.sentry-cdn.com/z987654321a.min.js 'excludedCodes' => ['400', '404', '429'], 'release' => getenv('SENTRY_RELEASE') ?: null, // Release number/name used by sentry. 'reportJsErrors' => false, 'sampleRate' => 1.0, 'ignoreErrors' => [ // Email link Microsoft Outlook crawler compatibility error // cf. https://forum.sentry.io/t/unhandledrejection-non-error-promise-rejection-captured-with-value/14062 "Non-Error promise rejection captured with value: Object Not Found Matching Id:", ] ], ];
致谢
基于Luke Youell的sentry插件Luke Youell。
许可证
版权所有© Born05
见许可证