thedomeffm / monolog-discord-handler-bundle
Monolog handler to push your logs to discord via webhook
Installs: 629
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 1
Open Issues: 0
Type:symfony-bundle
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
Adds a handler to monolog which can post your logs directly via discord webhook to your discord server channel.
Installation
composer require thedomeffm/monolog-discord-handler-bundle
Configuration
I've not added a recipe (or what ever I need to create 🤷), so you need to create the config by yourself.
# thedomeffm_monolog_discord_handler.yaml thedomeffm_monolog_discord_handler: discord: webhook_url: "%env(DISCORD_WEBHOOK_URL)%"
Add the env variable
DISCORD_WEBHOOK_URL="<your webhook url>"
Edit your monolog configuration
# monolog.yaml monolog: handlers: # your other handler... discord: type: service id: thedomeffm_monolog_discord_handler
Here is an example how a production config could look like:
# 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...