flamix/telegram-log
Composer 安装命令:
composer require flamix/telegram-log
包简介
Send laravel logs into Telegram Chat via bot
README 文档
README
composer require flamix/telegram-log
Configurations
Please define Telegram Bot Credentials and chat id as environment parameters by modifying .env on your project path
TELEGRAM_BOT_TOKEN=null TELEGRAM_CHAT_ID=null TELEGRAM_LOGGER_TEMPLATE=null TELEGRAM_OPTIONS=[]
By default LOG_CHANNEL will be set into stack so you need to set default logger on env after setting up configurations above
LOG_CHANNEL=telegram
Publish config file and views to override
php artisan vendor:publish --provider "Flamix\TelegramLog\TelegramServiceProvider"
use Illuminate\Support\Facades\Log; public function register() { $this->reportable(function (Throwable $e) { Log::channel('telegram')->emergency($e->getMessage(), ['file' => $e->getFile(), 'line' => $e->getLine()]); }); }
Create bot
For using this plugin, you need to create telegram bot
- Go to @BotFather in the Telegram
- Send
/newbot - Set up name and bot-name for your bot.
- Get token and add it to your .env file (it is written above)
- Go to your bot and send
/startmessage
Change log template at runtime
- Change config for template.
config(['telegram-logger.template'=>'laravel-telegram-logging::custom'])
- Use
Logas usual
统计信息
- 总下载量: 672
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-10