脉冲00/monolog-parser

用于解析monolog日志条目的解析器

0.0.3 2015-05-21 16:25 UTC

This package is not auto-updated.

Last update: 2024-09-14 14:55:34 UTC


README

Build Status Scrutinizer Code Quality

Latest Stable Version Total Downloads Latest Unstable Version License

一个简单的库,用于解析monolog日志文件。

安装

您可以通过将 pulse00/monolog-parser 添加到您的 composer.json 文件中,使用 composer 安装此库。

使用方法

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