This package provides a custom logger for Laravel that sends error logs to a Discord channel.
- Laravel version
11.x
or higher.
- Copy
DiscordLogger.php
to yourapp/Logging/
directory. - Add the configuration from
logging_config.php
to yourconfig/logging.php
file. - Add the environment variables from
.env.example
to your.env
file and fill in the values. - Install Guzzle if you haven't already:
composer require guzzlehttp/guzzle
- Update your exception handler (
app/Exceptions/Handler.php
orbootstrap/app.php
for Laravel 11+) to use the Discord logger:
use Illuminate\Support\Facades\Log;
// ... other code ...
$this->reportable(function (\Throwable $e) {
Log::channel('discord')->error($e->getMessage(), ['exception' => $e]);
});
within
->withExceptions(function (Exceptions $exceptions) {
//place here
}
Now your Laravel application will log errors to Discord.
Test before using. Repository: github respository