softonic/monolog-request-id-processor

此包已被废弃且不再维护。未建议替代包。

Monolog X-Request-ID 处理器,为所有日志添加可追溯性

1.0.0 2021-06-28 09:19 UTC

This package is auto-updated.

Last update: 2022-02-28 10:57:20 UTC


README

Latest Version Software License Build Status Total Downloads Average time to resolve an issue Percentage of issues still open

Monolog X-Request-ID 处理器,为所有日志添加可追溯性。

基于官方的 UidProcessor 实现,但使用 x-request-id 代替 uid

主要功能

  • 将提供的 x-request-id 添加到额外的日志字段。

安装

您可以使用 composer 需求最新版本的包

composer require softonic/monolog-request-id-processor

配置

use Monolog\Logger;

$requestId = 'fb703a2f-04ac-470c-bc6b-a4d965a7e404'; // Get x-request-id from any source instead of hardcode it.

$log = new Monolog\Logger('test');
$log->pushProcessor(new \Softonic\Monolog\Processors\RequestId($requestId));
$log->pushHandler(…);

$log->info('Interesting information about the request.');

测试

softonic/monolog-request-id-processor 有一个 PHPUnit 测试套件,以及一个使用 PHP CS Fixer 的编码风格合规性测试套件。

要从项目文件夹中运行测试,请运行以下命令。

$ make tests

在开发环境中打开终端

$ make debug

许可

Apache 2.0 许可证。有关更多信息,请参阅 LICENSE