PHP code example of softonic / monolog-request-id-processor

1. Go to this page and download the library: Download softonic/monolog-request-id-processor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

softonic / monolog-request-id-processor example snippets


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