eslym/laravel-discord-webhook-log

A Discord webhook handler for monolog in laravel

1.1.0 2022-03-05 01:53 UTC

This package is auto-updated.

Last update: 2024-05-05 21:46:02 UTC


README

<?php
# config/logging.php

return [
// ...

    'channels' => [

// ...

        'discord' => [
            'driver' => 'monolog',
            'handler' => \Eslym\Laravel\Log\DiscordWebhook\DiscordWebhookHandler::class,
            'with' => [
                'webhook' => env('DISCORD_LOG_WEBHOOK'),
                'message' => env('DISCORD_LOG_MESSAGE'),
            ],
            'formatter' => \Monolog\Formatter\LineFormatter::class,
            'formatter_with' => [
                'format' => '%message% %context% %extra%',
                'allowInlineLineBreaks' => true,
                'ignoreEmptyContextAndExtra' => true,
            ],
        ],

// ...

    ],

// ...
]
# .env
DISCORD_LOG_WEBHOOK="webhook url"
DISCORD_LOG_MESSAGE="Hey <@ (discord user id here) >! here is your log."