Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 831 Bytes

README.md

File metadata and controls

28 lines (18 loc) · 831 Bytes

Monolog Parser

A simple library for parsing monolog logfiles.

Installation

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

Usage

    require_once 'path/to/vendor/autoload.php';
    
    use Dubture\Monolog\Reader\LogReader;
    use Dubture\Monolog\Parser\LineLogParser;
    
    $logFile = '/path/to/some/monolog.log';
    $reader = new LogReader($logFile, new LineLogParser());
    
    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'));