urmaul/yii2-slack-log

将日志推送到 Slack 频道的 Yii2 日志路由器。

2.0.0 2016-09-05 12:45 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:20:36 UTC


README

将日志推送到 Slack 频道的 Yii2 日志路由器。

如何安装

  1. 将 " Incoming WebHook " 添加到 Slack。

  2. 附加日志路由。

    composer require urmaul/yii2-slack-log '~2.0'
    
  3. 将此路由添加到日志目标。

    'log' => [
        'targets' => [
            [
                'class' => 'urmaul\yii2\log\slack\Target',
                'levels' => ['error'], // Send message on errors
                'except' => ['yii\web\HttpException:403', 'yii\web\HttpException:404'], // ...except 403 and 404
                'enabled' => !YII_DEBUG, // No not send in debug mode
                'webhookUrl' => 'YOUR_WEBHOOK_URL_FROM_SLACK',
                //'username' => 'MYBOT', // Bot username. Defaults to app name
                //'icon_url' => null, // Bot icon URL
                //'icon_emoji' => ':beetle:', // Bot icon emoji
                //'prefixText' => '', // Any text prefix. As a sample, you can mention @yourself.
            ],
        ],
    ],