apextoolbox/laravel-logger 问题修复 & 功能扩展

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

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

apextoolbox/laravel-logger

Composer 安装命令:

composer require apextoolbox/laravel-logger

包简介

Apex Toolbox Laravel Logger

README 文档

README

PHP Version Laravel

Automatic error tracking, logging, and performance monitoring for Laravel applications. Part of ApexToolbox.

Installation

composer require apextoolbox/laravel-logger

Add to .env:

APEXTOOLBOX_ENABLED=true
APEXTOOLBOX_TOKEN=your_token_here

Add the log channel to config/logging.php:

'channels' => [
    // ... other channels

    'apextoolbox' => [
        'driver' => 'monolog',
        'handler' => \ApexToolbox\Logger\Handlers\ApexToolboxLogHandler::class,
        'level' => 'debug',
    ],
],

Update .env to include the channel in your log stack:

LOG_STACK=daily,apextoolbox

Add the middleware for HTTP request tracking (optional):

// bootstrap/app.php (Laravel 11+)
->withMiddleware(function (Middleware $middleware) {
    $middleware->append(\ApexToolbox\Logger\Middleware\LoggerMiddleware::class);
})

// Or app/Http/Kernel.php (Laravel 10)
protected $middleware = [
    \ApexToolbox\Logger\Middleware\LoggerMiddleware::class,
];

Done! The SDK automatically captures exceptions, logs, and database queries.

Configuration

Publish the config file for customization:

php artisan vendor:publish --tag=logger-config

This will create config/apextoolbox.php with the full configuration (all filtering options show their default values — you only need to override the sections you want to customize):

return [
    'enabled' => env('APEXTOOLBOX_ENABLED', true),
    'token' => env('APEXTOOLBOX_TOKEN', ''),

    // Paths to include/exclude from logging (supports wildcards)
    'path_filters' => [
        'include' => ['*'],
        'exclude' => ['_debugbar/*', 'telescope/*', 'horizon/*', 'api/health', 'api/ping'],
    ],

    // Headers filtering
    // 'exclude' removes headers entirely, 'mask' replaces values with '*******'
    'headers' => [
        'exclude' => [
            'authorization', 'x-api-key', 'cookie', 'x-auth-token',
            'x-access-token', 'x-refresh-token', 'bearer', 'x-secret',
            'x-private-key', 'authentication',
        ],
        'mask' => [
            'ssn', 'social_security', 'phone', 'email',
            'address', 'postal_code', 'zip_code',
        ],
    ],

    // Request body filtering
    // 'exclude' removes fields entirely, 'mask' replaces values with '*******'
    'body' => [
        'exclude' => [
            'password', 'password_confirmation', 'token', 'access_token',
            'refresh_token', 'api_key', 'secret', 'private_key', 'auth',
            'authorization', 'social_security', 'credit_card', 'card_number',
            'cvv', 'pin', 'otp',
        ],
        'mask' => [
            'ssn', 'social_security', 'phone', 'email',
            'address', 'postal_code', 'zip_code',
        ],
    ],

    // Response body filtering
    // 'exclude' removes fields entirely, 'mask' replaces values with '*******'
    'response' => [
        'exclude' => [
            'password', 'password_confirmation', 'token', 'access_token',
            'refresh_token', 'api_key', 'secret', 'private_key', 'auth',
            'authorization', 'social_security', 'credit_card', 'card_number',
            'cvv', 'pin', 'otp',
        ],
        'mask' => [
            'ssn', 'social_security', 'phone', 'email',
            'address', 'postal_code', 'zip_code',
        ],
    ],
];

Environment Variables

Variable Description Default
APEXTOOLBOX_TOKEN Your project token Required
APEXTOOLBOX_ENABLED Enable/disable tracking true

Requirements

  • PHP 8.1+
  • Laravel 10.x, 11.x, or 12.x

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固