A package for parsing monolog records including multiline support.
composer require roma-glushko/monolog-parser
require_once 'path/to/vendor/autoload.php';
use MonologParser\Reader\LogReader;
$logFile = '/path/to/some/monolog.log';
$reader = new LogReader($logFile);
foreach ($reader as $i => $log) {
echo sprintf(
"The #%s log entry was written at %s. \n",
$i,
$log['date']->format('Y-m-d h:i:s')
);
}
$lastLine = $reader[count($reader)-1];
echo sprintf(
"The last log entry was written at %s. \n",
$lastLine['date']->format('Y-m-d h:i:s')
);
This project is derived from pulse00/monolog-parser which is pretty cool but seems to be not actively supported and misses record mulitline support