beeproger/rocketchat-monolog-handler

A Monolog Rocket.Chat Handler meant for Laravel projects.

0.0.4 2019-10-10 11:48 UTC

This package is auto-updated.

Last update: 2024-04-10 23:15:14 UTC


README

A Monolog Rocket.Chat Handler meant for Laravel projects. It uses the same logic as the SlackWebhookHandler, available by default in the monolog package.

Install

composer require beeproger/rocketchat-monolog-handler

Usage

Add the following line to the imports part of logging.php

use Beeproger\Logging\RocketChatHandler;

Add the following code to channels in logging.php in the config folder.

    'rocketchat' => [
        'driver' => 'custom',
        'via' => RocketChatHandler::class,
        'url' => env('LOG_ROCKETCHAT_WEBHOOK_URL', ''),
        'channel' => env('LOG_ROCKETCHAT_CHANNEL', ''),
    ],

update the 'stack' channel from:

'channels'          => ['daily'],

to

'channels'          => ['daily', 'rocketchat'],

Add the following to your .env file:

LOG_ROCKETCHAT_WEBHOOK_URL=
LOG_ROCKETCHAT_CHANNEL=

And done!

FAQ:

  • How to create a webhook.
  • When using spaces in channel names like: 'This Channel' make sure to use the lowecase, kebab variant: 'this-channel' in the 'channel' value in your configuration.

License

This project is open-sourced software licensed under the MIT license