PHP code example of msschl / monolog-http-handler

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

    

msschl / monolog-http-handler example snippets




use Monolog\Logger;
use Msschl\Monolog\Handler\HttpHandler;

// create a log channel
$log = new Logger('name');

// push the HttpHandler to the monolog logger.
$log->pushHandler(new HttpHandler([
    'uri'     => 'https://localhost/your/endpoint/for/logging',
    'method'  => 'POST',
]));

// add records to the log
$log->warning('Foo');
$log->error('Bar');