lukam/logging-tap
Composer 安装命令:
composer require lukam/logging-tap
包简介
Adds logging tap functionality to Laravel 5.0 - 5.3
README 文档
README
Adds a logging tap functionality to Laravel versions from 5.0 to 5.3.
Installation
Install the package using Composer.
composer require lukam/logging-tap
Open up config/app.php and add the service provider to your existing providers array.
'providers' => [ LoggingTap\LogServiceProvider::class ]
Usage
Create a new logging tap using the artisan make:tap command. This will create a new tap file inside the App\Logging folder.
php artisan make:tap ExampleTap
Open up config/app.php, scroll down to "Logging Configuration" and add a log_tap array entry. Add your logging tap classes to this array. Any classes in this array will customize the Monolog instance when created.
'log_tap' => [App\Taps\ExampleTap::class],
For more information on how to work with logging taps refer to Laravel's logging documentation.
Examples
Create a logging tap to push a processor to Monolog instance:
<?php namespace App\Logging; use Monolog\Processor\UidProcessor; class PushProcessor { public function __invoke($logger, $arguments) { $logger->getMonolog()->pushProcessor(new UidProcessor); } }
Set Monolog instance formatter:
<?php namespace App\Logging; use Monolog\Formatter\LineFormatter; class Formatter { public function __invoke($logger, $arguments) { $format = "[%datetime%] - [%level_name%]: %message% %context% %extra%\n"; $formatter = new LineFormatter($format, null, true, true); foreach ($logger->getHandlers() as $handler) { $handler->setFormatter($formatter); } }
Testing
phpunit
License
The MIT License (MIT). See the license file for more information.
lukam/logging-tap 适用场景与选型建议
lukam/logging-tap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 03 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 lukam/logging-tap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lukam/logging-tap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-18