thedomeffm / monolog-discord-handler-bundle
Monolog处理器,通过webhook将日志推送到Discord
v0.0.5
2023-12-14 13:38 UTC
Requires
- php: >=8.1
- ext-curl: *
- monolog/monolog: ^3.0
- symfony/config: ^5.4|^6.0|^7.0
- symfony/dependency-injection: ^5.4|^6.0|^7.0
- symfony/http-kernel: ^5.4|^6.0|^7.0
Requires (Dev)
- phpunit/phpunit: ^10
README
为Monolog添加一个处理器,可以直接通过Discord webhook将日志发布到您的Discord服务器频道。
安装
composer require thedomeffm/monolog-discord-handler-bundle
配置
我没有添加配方(或者我需要创建什么 🤷),所以您需要自己创建配置。
# thedomeffm_monolog_discord_handler.yaml thedomeffm_monolog_discord_handler: discord: webhook_url: "%env(DISCORD_WEBHOOK_URL)%"
添加环境变量
DISCORD_WEBHOOK_URL="<your webhook url>"
编辑您的Monolog配置
# monolog.yaml monolog: handlers: # your other handler... discord: type: service id: thedomeffm_monolog_discord_handler
以下是一个生产配置的示例
# monolog.yaml when@prod: monolog: handlers: main: type: fingers_crossed action_level: error handler: main_group excluded_http_codes: [404, 405] buffer_size: 50 main_group: type: group members: ['error_stream', 'discord'] error_stream: type: stream path: php://stderr level: debug formatter: monolog.formatter.json discord: type: service id: thedomeffm_monolog_discord_handler # your other handler...