Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/roma-glushko/monolog-parser

🛠Parser for your monolog records
https://github.com/roma-glushko/monolog-parser

logs monolog parser php7

Last synced: about 1 month ago
JSON representation

🛠Parser for your monolog records

Awesome Lists containing this project

README

        

Monolog Parser
==============

![](https://github.com/roma-glushko/monolog-parser/workflows/CI/badge.svg)
[![Latest Stable Version](https://poser.pugx.org/roma-glushko/monolog-parser/v/stable)](https://packagist.org/packages/roma-glushko/monolog-parser)
[![License](https://poser.pugx.org/roma-glushko/monolog-parser/license)](https://packagist.org/packages/roma-glushko/monolog-parser)

A package for parsing [monolog](https://github.com/Seldaek/monolog) records including multiline support.

## Installation

```bash
composer require roma-glushko/monolog-parser
```

## Usage

```php
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')
);

```

## Credits

This project is derived from [pulse00/monolog-parser](https://github.com/pulse00/monolog-parser) which is pretty cool but seems to be not actively supported and misses record mulitline support