born05/craft-sentry

将Craft CMS错误推送到Sentry。

安装次数: 125,930

依赖: 3

建议者: 0

安全: 0

星标: 9

关注者: 8

分支: 11

开放问题: 6

类型:craft插件

3.0.0 2024-06-13 12:44 UTC

README

将Craft CMS错误推送到Sentry

安装

插件商店

  1. 搜索'Sentry SDK'。
  2. 点击安装
  3. 按照以下说明创建一个配置文件。

Composer

  1. 运行: composer require born05/craft-sentry
  2. 在管理 > 设置 > 插件中点击安装
  3. 按照以下说明创建一个配置文件。

要求

  • 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

许可证