Laravel/Lumen package to send logs to Telegram via Telegram Bot. This package adds the Lumen support for this Laravel package.
This version supports
- Laravel 5.6, 5.7, 5.8, 6.x, 7.x, 8.x, and 9.x
- Lumen 8.x and 9.x (older version not tested)
- Install via composer
composer require aqhmal/laravel-telegram-log
- Add or create a new channel in config/logging.php.
'telegram' => [
'driver' => 'custom',
'via' => Aqhmal\TelegramLog\TelegramLog::class,
'level' => env('LOG_LEVEL', 'debug'),
]
If you use stack as the default log channel, you can append the telegram channel in it.
'stack' => [
'driver' => 'stack',
'channels' => ['single', 'telegram'],
]
- Add in your .env the following variables with its value.
TELEGRAM_BOT_TOKEN=bot_token
TELEGRAM_CHAT_ID=chat_id
- Change the
LOG_CHANNEL
value in your .env totelegram
LOG_CHANNEL=telegram
Register a new Service Provider in bootstrap/app.php.
$app->register(Aqhmal\TelegramLog\TelegramLogServiceProvider::class);
You may write information to the logs using the Log facade. Refer here for more detail.
use Illuminate\Support\Facades\Log;
Log::emergency($message);
Log::alert($message);
Log::critical($message);
Log::error($message);
Log::warning($message);
Log::notice($message);
Log::info($message);
Log::debug($message);
This Telegram log package is licensed under the MIT license.