thecoder / laravel-monolog-telegram
Telegram Handler for Monolog
Installs: 14 571
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 2
Forks: 4
Open Issues: 0
Requires
- ext-curl: *
- ext-mbstring: *
- monolog/monolog: ^1.0|^2.0|^3.0
README
🔔 Telegram Handler for Monolog
Installation
Install using composer:
composer require thecoder/laravel-monolog-telegram
Usage
Open config/logging.php and change the file
'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single', 'telegram'], ], .... 'telegram' => [ 'driver' => 'monolog', 'level' => 'debug', 'handler' => TheCoder\MonologTelegram\TelegramBotHandler::class, 'handler_with' => [ 'token' => env('LOG_TELEGRAM_BOT_TOKEN'), 'chat_id' => env('LOG_TELEGRAM_CHAT_ID'), 'topic_id' => env('LOG_TELEGRAM_TOPIC_ID',null), 'bot_api' => env('LOG_TELEGRAM_BOT_API', 'https://api.telegram.org/bot'), 'proxy' => env('LOG_TELEGRAM_BOT_PROXY', null), ], 'formatter' => TheCoder\MonologTelegram\TelegramFormatter::class, 'formatter_with' => [ 'tags' => env('LOG_TELEGRAM_TAGS', null), ], ], ]
Add the following variables to your .env file.
LOG_TELEGRAM_BOT_TOKEN= LOG_TELEGRAM_CHAT_ID= # If chat groups are used instead of telegram channels, # and the ability to set topics on groups is enabled, # this configuration can be utilized. LOG_TELEGRAM_TOPIC_ID= #LOG_TELEGRAM_BOT_API='https://api.telegram.org/bot' # add tor proxy for restricted country #LOG_TELEGRAM_BOT_PROXY='socks5h://localhost:9050'