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: ' ,
],
],
],
],