aqhmal/laravel-telegram-log 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

aqhmal/laravel-telegram-log

最新稳定版本:1.1.1

Composer 安装命令:

composer require aqhmal/laravel-telegram-log

包简介

A package to send Laravel/Lumen logs to Telegram via Telegram Bot.

README 文档

README

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)

PHP Version Require Total Downloads Version license

Installation

  1. Install via composer
composer require aqhmal/laravel-telegram-log
  1. 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'],
]
  1. Add in your .env the following variables with its value.
TELEGRAM_BOT_TOKEN=bot_token
TELEGRAM_CHAT_ID=chat_id
  1. Change the LOG_CHANNEL value in your .env to telegram
LOG_CHANNEL=telegram

Lumen Support

Register a new Service Provider in bootstrap/app.php.

$app->register(Aqhmal\TelegramLog\TelegramLogServiceProvider::class);

Usage

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);

License

This Telegram log package is licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-03