- Send log to telegram chat.
- Accept string, array, object, json;
composer require mttzzz/laravel-telegram-log
php artisan vendor:publish --provider mttzzz\laravelTelegramLog\TelegramLogServiceProvider
Edit app/config/telegramLog.php and fill your Telegram Bot token and chatId or add env variables.
return [
// Telegram Bot Token
'token' => env('TELEGRAM_LOG_BOT_TOKEN', '111111:AAF99VnmhsE6HQtH6vsQaBRLctxXs4-UpdY'),
// Telegram Chat Id
'chat_id' => env('TELEGRAM_LOG_CHAT_ID', '-1111111111111'),
];
Edit app/config/logging.php and add channel "telegram" and change channel "stack" value 'channels' by then (example).
return [
'stack' => [
'driver' => 'stack',
'channels' => ['daily', 'telegram'],
'ignore_exceptions' => false,
],
'telegram' => [
'driver' => 'monolog',
'handler' => \mttzzz\laravelTelegramLog\HandlerTelegramLogger::class
]
];
Telegram::log('test');
Telegram::log(['test' => 'test']);
Telegram::log({"test" : "test"});