<?php
require(ROOT_PATH . 'vendor/autoload.php');
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\PHPConsoleHandler;
// Create some handlers
$stream = new StreamHandler(__DIR__ . '/my_app.log', Logger::DEBUG);
$php_console = new PHPConsoleHandler();
// Create the main logger of the app
$logger = new Logger('my_logger');
$logger->pushHandler($stream);
$logger->pushHandler($php_console);
$record['age'] = 1;
// You can now use your logger
$logger->pushProcessor(function ($record) {
$record['extra']['dummy'] = 'Hello world!';
return $record;
});
$logger->addInfo('Adding a new info', $record);