Monolog sends your logs to files, sockets, inboxes, databases and various web services. See the complete reference
This library extends Monolog's handlers and processors adding data to the record generated from processors. Furthermore the library improves logs format.
Install the latest version with
$ composer require stuzzo/monolog-extender
<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
// create a log channel
$log = new Logger('request');
$handler = new StreamHandler('path/to/your.log', Logger::WARNING);
$formatter = new \Stuzzo\Monolog\Formatter\StreamFormatter(null, 'Y-m-d H:i:s');
$handler->setFormatter($formatter);
$log->pushHandler($handler);
try {
throw new \RuntimeException('Something happen');
} catch (\Exception $exception) {
$log->critical('Error', ['exception' => $exception]);
}
- This library works with PHP 5.5.9 or above.
Alfredo Aiello - [email protected] - http://twitter.com/stuzzo