承接 arielblackymetal/endpoint-logger 相关项目开发

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

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

arielblackymetal/endpoint-logger

最新稳定版本:v2.2.0

Composer 安装命令:

composer require arielblackymetal/endpoint-logger

包简介

Un driver de logging de Laravel para enviar logs a un endpoint.

README 文档

README

A Laravel logging driver package for sending logs to a centralized endpoint with support for custom business reporting levels.

Features

  • Custom driver for Laravel Logging
  • Automatic log sending to HTTP endpoint
  • Standard logging levels (debug, info, warning, error, critical)
  • NEW: Custom levels for business reporting
  • WebProcessor included for additional web context information

Custom Levels Available

The package includes custom levels designed for business reporting:

  • INVOICE (250) - For billing-related logs

Installation

  1. Install the package via Composer:
composer require arielblackymetal/endpoint-logger
  1. The ServiceProvider will be automatically registered in Laravel.

Configuration

Add a channel in your config/logging.php file:

'channels' => [
    // ... existing channels ...

    'ax1-info' => [
        'driver' => 'endpoint',
        'url' => 'https://your-endpoint.com/api/logs',
        'level' => 'debug', // Minimum level to capture all logs
    ],

    'ax1-invoice' => [
        'driver' => 'endpoint',
        'url' => 'https://your-endpoint.com/api/logs',
        'level' => 'invoice', // Only captures invoice level and above
    ],
],

Usage

Standard Levels

Log::channel('ax1-info')->info('Information message');
Log::channel('ax1-info')->error('System error');
Log::channel('ax1-info')->warning('Important warning');

Custom Business Levels

// Invoice
Log::channel('ax1-info')->invoice('Sales report generated', ['count' => 2, 'amount' => 150.00]);

Payload Structure

Each log sent to the endpoint includes:

{
    "severity": 250,
    "log_type": "INVOICE",
    "message": "Invoice transmitted",
    "context": {
        "count": 2,
        "amount": 150.00
    },
    "app_name": "My Application",
    "ocurred_at": "2024-01-15T10:30:00+00:00",
    "metadata": {
        // Additional web context information
    }
}

Benefits of Custom Levels

  1. Smart Filtering: Configure channels that only capture specific types of business logs
  2. Specific Reporting: Generate reports based on specific event types
  3. Business Monitoring: Separate technical logs from business logs
  4. Advanced Analytics: Enable granular analysis of different business aspects

Advanced Configuration Examples

Invoice-Only Channel

'ax1-invoice-only' => [
    'driver' => 'endpoint',
    'url' => 'https://your-endpoint.com/api/invoices',
    'level' => 'invoice', // Only captures invoice logs
],

Channel for All Business Events

'ax1-business' => [
    'driver' => 'endpoint',
    'url' => 'https://your-endpoint.com/api/business',
    'level' => 'invoice', // Captures invoice and all levels above
],

Requirements

  • PHP >= 8.1
  • Laravel >= 10.0
  • Monolog >= 3.0

License

This package is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-08-15