https://github.com/sysvale/rocketchat-monolog-handler
A Rocket.chat Monolog Handler meant to be used in Laravel projects developed by Sysvale Softgroup
https://github.com/sysvale/rocketchat-monolog-handler
hacktoberfest laravel monolog-handler sysvale
Last synced: about 1 month ago
JSON representation
A Rocket.chat Monolog Handler meant to be used in Laravel projects developed by Sysvale Softgroup
- Host: GitHub
- URL: https://github.com/sysvale/rocketchat-monolog-handler
- Owner: Sysvale
- License: mit
- Created: 2020-04-30T19:45:14.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-13T01:14:04.000Z (over 2 years ago)
- Last Synced: 2025-04-24T03:47:53.122Z (about 1 month ago)
- Topics: hacktoberfest, laravel, monolog-handler, sysvale
- Language: PHP
- Homepage:
- Size: 41 KB
- Stars: 8
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [Rocket.chat](https://rocket.chat/) Monolog Handler by Sysvale

Monolog Handler para ser usado em projetos Laravel. Adaptado da implementação para Slack.
Inspirado nos seguintes projetos:
- https://github.com/beeproger/rocketchat-monolog-handler- https://github.com/martinusso/monolog-rocketchat-handler
## Instalação
```bash
composer require sysvale/rocketchat-monolog-handler
```## Uso
Importe a seguinte classe no seu `config/logging.php`
```php
use Sysvale\Logging\RocketChatHandler;
```Adicione o código abaixo ao Array de `channels` no arquivo `logging.php`
```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:
```php
'channels' => ['daily'],
```para:
```php
'channels' => ['daily', 'rocketchat'],
```Lembre-se de adicionar as variáveis de ambiente
```
ROCKET_CHAT_WEBHOOK=
```[Configure um WebHook](https://rocket.chat/docs/administrator-guides/integrations/) no seu servidor do Rocket.Chat
Você pode utilizar o seguinte script:
```javascript
/* 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
}
};
}
}
```