softonic/monolog-request-id-processor

This package is abandoned and no longer maintained. No replacement package was suggested.

Monolog X-Request-ID processor to add traceability to all logs

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 processor to add traceability to all logs.

Processor based on the official UidProcessor implementation, but using x-request-id instead of uid.

Main features

  • Add to the extra logs field the x-request-id provided.

Installation

You can require the last version of the package using composer

composer require softonic/monolog-request-id-processor

Configuration

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

Testing

softonic/monolog-request-id-processor has a PHPUnit test suite, and a coding style compliance test suite using PHP CS Fixer.

To run the tests, run the following command from the project folder.

$ make tests

To open a terminal in the dev environment:

$ make debug

License

The Apache 2.0 license. Please see LICENSE for more information.