承接 emotality/laravel-telegram-logger 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

emotality/laravel-telegram-logger

最新稳定版本:1.0.6

Composer 安装命令:

composer require emotality/laravel-telegram-logger

包简介

Laravel package to report exceptions to a Telegram chat, group or channel.

README 文档

README

License Latest Version Total Downloads

Laravel package to report exceptions to a Telegram chat, group or channel.

Requirements

  • PHP 8.1+
  • Laravel 10

Installation

  1. composer require emotality/laravel-telegram-logger
  2. php artisan vendor:publish --provider="Emotality\Telegram\TelegramLoggerServiceProvider"
  3. Add the following lines to your .env:
TELEGRAM_APP_NAME="A non-APP_NAME name" // optional
TELEGRAM_API_KEY="<telegram_api_key>"
TELEGRAM_CHAT_ID="<telegram_chat_id>"
  1. Add the telegram block to the channels array, inside your config/logging.php file:
'channels' => [
    ...
    'telegram' => [
        'driver' => 'telegram',
        'level' => env('LOG_LEVEL', 'error'),
        'cache_ttl' => env('TELEGRAM_CACHE_TTL', 300),
    ],
],
Note: Read more about the cache_ttl key below.
  1. Update your log stack and add telegram to the channels array in config/logging.php:
'stack' => [
    'driver' => 'stack',
    'channels' => ['daily', 'telegram'],
    ...,
],

or change your LOG_CHANNEL in your .env:

LOG_CHANNEL=telegram

Caching TTL explained:

A MD5 checksum is being created for every exception, then that checksum is being cached for the cache_ttl seconds you provide. If checksum exists in the cache, the log will not be sent.

In other words, when the exact same exception reoccurs, only the first exception will be logged, if after 300 seconds it still occurs, it will be logged again.
Only the first occurrence of the same exception will be logged every 300 seconds to avoid flooding the Telegram API and your chat.

The cache_ttl key accepts false to disable caching, meaning, each and every exception will be logged to Telegram, even if it's 1000 of the same exception.

License

laravel-telegram-logger is released under the MIT license. See LICENSE for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-01