yii2 slack log
v2.0.1
Yii 2 的漂亮 Slack 日志目标。
安装此扩展的首选方法是通过 Composer。
要么运行
composer require " sergeymakinen/yii2-slack-log:^2.0 "
或添加
"sergeymakinen/yii2-slack-log" : " ^2.0 "
到composer.json
文件的 require 部分。
首先在您的 Slack 团队中设置传入 Webhook 集成并获取令牌。它应该看起来像https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
。
然后设置以下 Yii 2 配置参数:
' components ' => [
' log ' => [
' targets ' => [
[
' class ' => ' sergeymakinenyiislacklogTarget ' ,
' webhookUrl ' => ' https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX ' ,
],
],
],
],
示例配置:
' components ' => [
' log ' => [
' targets ' => [
[
' class ' => ' sergeymakinenyiislacklogTarget ' ,
' levels ' => [ ' error ' ],
' except ' => [
' yiiwebHttpException:* ' ,
],
' enabled ' => YII_ENV_PROD ,
' webhookUrl ' => ' https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX ' ,
' username ' => ' Fire Alarm Bot ' ,
' iconEmoji ' => ' :poop: ' ,
],
],
],
],