wendelulhoa/laravel-discord-logger-simple

Logging to a discord channel in Laravel

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/wendelulhoa/laravel-discord-logger-simple

dev-master 2024-04-11 18:21 UTC

This package is auto-updated.

Last update: 2025-10-11 21:59:08 UTC


README

Latest Version on Packagist Software License Total Downloads

wu/laravel-discord-logger-simple is a laravel package providing a logging handler to send logs to a Discord channel.

Installation

You can install the package via composer:

composer wendelulhoa/laravel-discord-logger-simple

Setup

// config/app.php
'providers' => [
    ...
    Wendelulhoa\WuDiscordLogger\ServiceProviderWuDiscordLogger::class
];

Prepare the discord channel web hook

Create a discord web hook for the channel which will receive the logs.

Prepare the logger configuration

You must add a new channel to your config/logging.php file:

// config/logging.php
'channels' => [
    //...
    'discord' => [
        'driver' => 'custom',
        'via'    => WU\WuDiscordLogger\WuDiscordLogger::class,
        'level'  => 'debug',
        'url'    => env('LOG_DISCORD_WEBHOOK_URL'),
        'ignore_exceptions' => env('LOG_DISCORD_IGNORE_EXCEPTIONS', false),
    ],
];

You can then provide the web-hook URL in your .env file:

LOG_DISCORD_WEBHOOK_URL=https://discordapp.com/api/webhooks/abcerd/1234

You can then publish the configuration file:

php artisan vendor:publish --provider "Wendelulhoa\WuDiscordLogger\ServiceProviderWuDiscordLogger"

Use the logger channel

You have two options: log only to discord or add the channel to the stack

Logging to multiple Discord channels

Of course, you can send your log messages to multiple Discord channels. Just create as many channels as desired in config/logging.php and put them in the stack. Each channel should be named differently and should point to a different web hook URL.

Version history

See the dedicated change log

License

The MIT License (MIT). Please see License File for more information.