sasha1344/monolog-parser

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

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

This package is auto-updated.

Last update: 2024-09-10 12:50:04 UTC


README

Build Status Scrutinizer Code Quality

Latest Stable Version Total Downloads Latest Unstable Version License

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

安装

您可以通过将sasha1344/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'));