Add ProjectZomboidBurdJournalsLog (BurdJournals.txt)

Per-line warnings emitted by the BurdJournals mod, format
'[time] [BurdJournals] LEVEL: message.'. Parser captures time, the
[BurdJournals] tag as the entry prefix, and the LEVEL token. Detectors:
filename match plus content signature on the literal '[BurdJournals]'
tag bracket.
This commit is contained in:
2026-04-30 20:42:52 +00:00
parent d7c36ffc07
commit 27424f6a14
4 changed files with 111 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
namespace IndifferentKetchup\Codex\Log\ProjectZomboid;
use IndifferentKetchup\Codex\Analyser\AnalyserInterface;
use IndifferentKetchup\Codex\Analyser\PatternAnalyser;
use IndifferentKetchup\Codex\Detective\FilenameDetector;
use IndifferentKetchup\Codex\Detective\WeightedSinglePatternDetector;
use IndifferentKetchup\Codex\Parser\ParserInterface;
use IndifferentKetchup\Codex\Parser\PatternParser;
use IndifferentKetchup\Codex\Pattern\ProjectZomboid\BurdJournalsPattern;
class ProjectZomboidBurdJournalsLog extends ProjectZomboidEventLog
{
public static function getDefaultParser(): ParserInterface
{
return static::makePatternParser(
BurdJournalsPattern::LINE,
[PatternParser::TIME, PatternParser::PREFIX, PatternParser::LEVEL]
);
}
public static function getDefaultAnalyser(): AnalyserInterface
{
return new PatternAnalyser();
}
public static function getDetectors(): array
{
return [
(new FilenameDetector())
->setPattern('/_BurdJournals\.txt$/')
->setWeight(0.95),
(new WeightedSinglePatternDetector())
->setPattern('/\[BurdJournals\]/')
->setWeight(0.95),
];
}
public function getTitle(): string
{
return "Project Zomboid BurdJournals Mod Log";
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace IndifferentKetchup\Codex\Pattern\ProjectZomboid;
/**
* Regex constants for the Project Zomboid BurdJournals.txt format.
*
* [time] [BurdJournals] LEVEL: message.
*
* LINE captures, in order:
* 1. time
* 2. tag (e.g. BurdJournals)
* 3. level (WARNING | ERROR | INFO | DEBUG)
*/
class BurdJournalsPattern
{
public const string LINE = '/^\[(\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3})\] \[(\w+)\] (WARNING|ERROR|INFO|DEBUG): .+\.?$/';
}