### Install laravel-discord-logger with Composer Source: https://github.com/jeffersongoncalves/laravel-discord-logger/blob/master/README.md Install the package via Composer. ```bash composer require jeffersongoncalves/laravel-discord-logger ``` -------------------------------- ### Install and test Discord logger with artisan commands Source: https://github.com/jeffersongoncalves/laravel-discord-logger/blob/master/README.md Commands to publish the configuration and send a test message to verify the webhook. The test command sends inline directly to the webhook. ```bash # Publish the config + optionally star the repo php artisan discord-logger:install # Send a test message to verify the webhook php artisan discord-logger:test --channel=discord ``` -------------------------------- ### Run tests with composer test Source: https://github.com/jeffersongoncalves/laravel-discord-logger/blob/master/README.md Run the test suite for the package. ```bash composer test ``` -------------------------------- ### Publish laravel-discord-logger config Source: https://github.com/jeffersongoncalves/laravel-discord-logger/blob/master/README.md Publish the package configuration file (optional). ```bash php artisan vendor:publish --tag="laravel-discord-logger-config" ``` -------------------------------- ### Configure per-level webhooks and mentions Source: https://github.com/jeffersongoncalves/laravel-discord-logger/blob/master/README.md Routes specific log levels to their own webhook and configures mentions for those levels. 'allowed_mentions' is set automatically so @here, @everyone, role, and user pings actually fire. ```php 'webhooks' => [ 'EMERGENCY' => env('DISCORD_LOGGER_WEBHOOK_ALERTS'), 'CRITICAL' => env('DISCORD_LOGGER_WEBHOOK_ALERTS'), ], 'mentions' => [ 'EMERGENCY' => '@here', 'CRITICAL' => '<@&123456789012345678>', // role id ], ``` -------------------------------- ### Set Discord webhook URL in .env Source: https://github.com/jeffersongoncalves/laravel-discord-logger/blob/master/README.md Sets the Discord webhook URL in the environment. Leave empty in local/testing to send nothing without breaking anything. ```dotenv LOG_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/xxx/yyy ``` -------------------------------- ### Configure Discord channel in config/logging.php Source: https://github.com/jeffersongoncalves/laravel-discord-logger/blob/master/README.md Adds a custom Discord logging channel to config/logging.php. Uses the Logger class, reads the webhook URL from LOG_DISCORD_WEBHOOK_URL, and defaults the level to 'error'. ```php 'discord' => [ 'driver' => 'custom', 'via' => \JeffersonGoncalves\DiscordLogger\Logger::class, 'level' => env('LOG_DISCORD_LEVEL', 'error'), 'url' => env('LOG_DISCORD_WEBHOOK_URL'), ], ``` -------------------------------- ### Stack Discord channel onto default stack Source: https://github.com/jeffersongoncalves/laravel-discord-logger/blob/master/README.md Stacks the Discord channel onto the default 'single' channel so errors fan out to both. Set 'ignore_exceptions' to false to keep exception handling active. ```php 'stack' => [ 'driver' => 'stack', 'channels' => ['single', 'discord'], 'ignore_exceptions' => false, ], ``` -------------------------------- ### Fix missing Discord log messages with queue worker or DISCORD_LOGGER_QUEUE=false Source: https://github.com/jeffersongoncalves/laravel-discord-logger/blob/master/README.md Commands to fix the issue where Log::debug/info/error(...) calls do not appear in Discord. Run a queue worker or set DISCORD_LOGGER_QUEUE=false to send inline without a worker. ```bash php artisan queue:work ``` ```bash DISCORD_LOGGER_QUEUE=false ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.