sasha1344/monolog-parser

A parser for monolog log entries

v1.0.2 2023-07-10 10:23 UTC

This package is auto-updated.

Last update: 2024-06-10 12:18:28 UTC


README

Build Status Scrutinizer Code Quality

Latest Stable Version Total Downloads Latest Unstable Version License

A simple library for parsing monolog logfiles.

Installation

You can install the library using composer by adding sasha1344/monolog-parser to your composer.json.

Usage

require_once 'path/to/vendor/autoload.php';
  
use Dubture\Monolog\Reader\LogReader;
    
$logFile = '/path/to/some/monolog.log';
$reader = new LogReader($logFile);
   
foreach ($reader as $log) {
    echo sprintf("The log entry was written at %s. \n", $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'));