haokaiyang/laravel-feishu-logging

Send logs to Feishu group via Feishu Custom bot

Downloads

4

Stars

2

Version

0.1.0

Laravel Feishu logger

Send logs to Feishu group via Feishu Custom bot

Install


composer require haokaiyang/laravel-feishu-logging

Document: 机器人 | 如何在群聊中使用机器人?

Define feishu custom bot Token and set as environment parameters. Add to your environment file

token is a part of Feishu Webhook url

if your Webhook is (https://open.feishu.cn/open-apis/bot/hook/xxxxxxxxxxxxxxxxxxxxxxxxxxx)

token is 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'

FEISHU_LOGGER_BOT_TOKEN=token

Add to config/logging.php file new channel: if you want to setting different feishu custom bot,you can define token into channel setting

'feishu' => [
    'driver' => 'custom',
    'via'    => Logger\FeishuLogger::class,
    'level'  => 'debug',
    'token'  => env('FEISHU_LOGGER_BOT_TOKEN', 'YOUR-CUSTOM-BOT-TOKEN'),
]

If your default log channel is a stack, you can add it to the stack channel like this

'stack' => [
    'driver' => 'stack',
    'channels' => ['single', 'feishu'],
]

Or you can simply change the default log channel in the .env

LOG_CHANNEL=feishu

Publish config file

php artisan vendor:publish --provider "Logger\FeishuLoggerServiceProvider"
haokaiyang

Author

haokaiyang