sysvale / rocketchat-monolog-handler
A Rocket.chat Monolog Handler meant to be used in Laravel projects developed by Sysvale Softgroup
Installs: 10 430
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 9
Open Issues: 0
Requires
- php: >=7.1 || ^8.0 || ^8.1
- guzzlehttp/guzzle: ^6.0 || ^7.5
- monolog/monolog: ^1.12 || ^2.3
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-11-13 05:26:25 UTC
README
Monolog Handler para ser usado em projetos Laravel. Adaptado da implementação para Slack.
Inspirado nos seguintes projetos:
Instalação
composer require sysvale/rocketchat-monolog-handler
Uso
Importe a seguinte classe no seu config/logging.php
use Sysvale\Logging\RocketChatHandler;
Adicione o código abaixo ao Array de channels
no arquivo logging.php
'rocketchat' => [ 'driver' => 'monolog', 'handler' => RocketChatHandler::class, 'with' => [ 'webhooks' => [env('ROCKET_CHAT_WEBHOOK', '')], 'username' => 'Awesome Laravel Bot', 'emoji' => ':rotating_light:', ], 'level' => 'warning', ],
Atualize o canal stack
de:
'channels' => ['daily'],
para:
'channels' => ['daily', 'rocketchat'],
Lembre-se de adicionar as variáveis de ambiente
ROCKET_CHAT_WEBHOOK=
Configure um WebHook no seu servidor do Rocket.Chat
Você pode utilizar o seguinte script:
/* exported Script */ /* globals console, _, s */ /** Global Helpers * * console - A normal console instance * _ - An underscore instance * s - An underscore string instance */ class Script { /** * @params {object} request */ process_incoming_request({ request }) { // console is a global helper to improve debug console.log(request); return { content:{ text: request.content.text, username: request.content.username, emoji: request.content.emoji, attachments: request.content.attachments } }; } }