rekurzia / yii2-sentry-log-target

Yii2 日志目标的最低实现,用于将消息发送到 Sentry。

v2.0.0 2016-12-27 21:32 UTC

This package is not auto-updated.

Last update: 2024-09-26 00:14:46 UTC


README

Build Status Latest Stable Version License

将日志消息发送到您的 Sentry 实例的 Yii2 日志目标。

安装

使用 Composer

composer require rekurzia/yii2-sentry-log-target

用法

将 Sentry 目标添加到您的配置中

$config['components']['log']['targets'] = [
    [
        'class' => Rekurzia\Log\SentryTarget::class,
        'levels' => ['error', 'warning'],
        'dsn' => 'https://abcdefgh:12345678@sentry.example.com/1',
        'includeContextMessage' => true,
        'options' => [
            'message_limit' => 2048,
        ],
    ],
];

配置

dsn

Raven 兼容的 DSN。

options

这些选项将传递给 Raven_Client 构造函数

includeContextMessage

此选项允许您隐藏 info 级别上下文消息。

默认情况下,Yii 也会为您生成上下文消息。这意味着在错误情况下,您的 Sentry 实例上将有两条消息记录。第一条是 error 级别,第二条是 info 级别。

许可

MIT。请参阅 LICENSE 文件。