PHP code example of wyrihaximus / psr-3-context-logger
1. Go to this page and download the library: Download wyrihaximus/psr-3-context-logger 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/ */
wyrihaximus / psr-3-context-logger example snippets
$logger = new Psr3Logger();
$contextLogger = new ContextLogger($logger, ['key' => 'value']);
$contextLogger->info('Message'); // $logger will be called with: log('info', 'Message', ['key' => 'value']);
$logger = new Psr3Logger();
$contextLogger = new ContextLogger($logger, ['key' => 'value'], 'Prefix');
$contextLogger->info('Message'); // $logger will be called with: log('info', '[Prefix] Message', ['key' => 'value']);