urmaul/yii-slack-log

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

1.1.2 2017-03-10 08:02 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:31:33 UTC


README

将日志推送到 Slack 频道的 Yii 日志路由。这是基于 yii2-slack-log 进行修改,以适应 Yii 1.1。

如何安装

  1. 在 Slack 中添加 "Incoming WebHook"。

  2. 附加日志路由。

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

    'log' => [
        'class'=>'CLogRouter',
        'routes' => [
            [
                'class' => 'urmaul\yii\log\slack\Target',
                'levels' => 'error', // Send message on errors
                'except' => 'exception.CHttpException.404', // ...except 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
                //'prefix' => '', // Any text prefix. As a sample, you can mention @yourself.
            ],
        ],
    ],