PHP code example of theipster / monolog-utils

1. Go to this page and download the library: Download theipster/monolog-utils 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/ */

    

theipster / monolog-utils example snippets


use Monolog\Logger;
use TheIpster\MonologUtils\RequestHeaderProcessor;

// Marshal superglobals into a PSR-7 request.
$request = ...;

// Build logger.
$logger = Logger(...);
$logger->pushProcessor(new RequestHeaderProcessor($request, 'X-My-Custom-Header', 'my_custom_header'));

// Log stuff.
$logger->info('Some message.');

use Monolog\Logger;
use TheIpster\MonologUtils\XRequestIdProcessor;

// Marshal superglobals into a PSR-7 request.
$request = ...;

// Build logger.
$logger = Logger(...);
$logger->pushProcessor(new XRequestIdProcessor($request));

// Log stuff.
$logger->info('Some message.');