From 27424f6a14e42dcc0b4738a62bc9361717cc88ba Mon Sep 17 00:00:00 2001 From: indifferentketchup Date: Thu, 30 Apr 2026 20:42:52 +0000 Subject: [PATCH] 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. --- .../ProjectZomboidBurdJournalsLog.php | 44 +++++++++++++++++++ .../ProjectZomboid/BurdJournalsPattern.php | 18 ++++++++ .../fixtures/burd-journals-minimal.txt | 5 +++ .../Log/ProjectZomboidBurdJournalsLogTest.php | 44 +++++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 src/Log/ProjectZomboid/ProjectZomboidBurdJournalsLog.php create mode 100644 src/Pattern/ProjectZomboid/BurdJournalsPattern.php create mode 100644 test/src/Games/ProjectZomboid/fixtures/burd-journals-minimal.txt create mode 100644 test/tests/Games/ProjectZomboid/Log/ProjectZomboidBurdJournalsLogTest.php diff --git a/src/Log/ProjectZomboid/ProjectZomboidBurdJournalsLog.php b/src/Log/ProjectZomboid/ProjectZomboidBurdJournalsLog.php new file mode 100644 index 0000000..9f039c3 --- /dev/null +++ b/src/Log/ProjectZomboid/ProjectZomboidBurdJournalsLog.php @@ -0,0 +1,44 @@ +setPattern('/_BurdJournals\.txt$/') + ->setWeight(0.95), + (new WeightedSinglePatternDetector()) + ->setPattern('/\[BurdJournals\]/') + ->setWeight(0.95), + ]; + } + + public function getTitle(): string + { + return "Project Zomboid BurdJournals Mod Log"; + } +} diff --git a/src/Pattern/ProjectZomboid/BurdJournalsPattern.php b/src/Pattern/ProjectZomboid/BurdJournalsPattern.php new file mode 100644 index 0000000..6c556b1 --- /dev/null +++ b/src/Pattern/ProjectZomboid/BurdJournalsPattern.php @@ -0,0 +1,18 @@ +setLogFile(new PathLogFile($this->fixturePath())); + $log->parse(); + + $this->assertCount(5, $log->getEntries()); + } + + public function testLevelAndPrefixAreParsed(): void + { + $log = (new ProjectZomboidBurdJournalsLog())->setLogFile(new PathLogFile($this->fixturePath())); + $log->parse(); + + $first = $log->getEntries()[0]; + $this->assertSame(Level::WARNING, $first->getLevel()); + $this->assertSame('BurdJournals', $first->getPrefix()); + } + + public function testDetectiveDispatchesByContent(): void + { + $detective = (new Detective()) + ->setLogFile(new PathLogFile($this->fixturePath())) + ->addPossibleLogClass(ProjectZomboidBurdJournalsLog::class); + + $this->assertInstanceOf(ProjectZomboidBurdJournalsLog::class, $detective->detect()); + } +}