定制 revangelista/telegram-logger 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

revangelista/telegram-logger

最新稳定版本:1.4.0

Composer 安装命令:

composer require revangelista/telegram-logger

包简介

Send logs to Telegram chat via Telegram bot

README 文档

README

Send logs to Telegram chat via Telegram bot in your Laravel application

Install


composer require revangelista/telegram-logger

Set a new channel in the config/logging.php file, with the following variables:

'telegram' => [
    'driver'  => 'custom',
    'via'     => Logger\TelegramLogger::class,
    'level'   => 'debug',
    'token'   => '<YOUR_BOT_TOKEN>',
    'chat_id' => '<CHAT_ID>',
]

Where token is the token of your Telegram bot and chat_id is where the bot will send the messages

If you want your Telegram bot to send log messages for more than one chat at the same time, you can write the channel settings like this:

'telegram' => [
    'driver'  => 'custom',
    'via'     => Logger\TelegramLogger::class,
    'level'   => 'debug',
    'token'   => '<YOUR_BOT_TOKEN>',
    'chat_id' => [
        '<CHAT_ID_1>',
        '<CHAT_ID_2>',
        '<CHAT_ID_3>'
    ]
]

If your default log channel is a stack, you can add it to the stack channel like this:

'stack' => [
    'driver' => 'stack',
    'channels' => ['single', 'telegram'],
]

Or you can simply change the default log channel in the .env

LOG_CHANNEL=telegram

Logging

For more information on custom log channels, check the Laravel documentation on this.

Create bot

For using this package you need to create Telegram bot

  1. Go to @BotFather in the Telegram
  2. Send /newbot
  3. Set up name and bot-name for your bot.
  4. Get token and add it to your .env file (it is written above)
  5. Go to your bot and send /start message

统计信息

  • 总下载量: 8.02k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-13