1. Go to this page and download the library: Download petert82/monolog-logfmt 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/ */
petert82 / monolog-logfmt example snippets
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Petert82\Monolog\Formatter\LogfmtFormatter;
$log = new Logger('name');
$handler = new StreamHandler('php://stdout', Logger::WARNING);
$handler->setFormatter(new LogfmtFormatter());
$log->pushHandler($handler);
$log->addError('Danger! High voltage!', ['voltage' => 9000]);