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,5 @@
[28-04-26 16:57:42.411] [BurdJournals] WARNING: Character ID mismatch in deleteBaseline! Client sent: local_a_b_c, Server computed: 0_a_b.
[28-04-26 17:05:58.532] [BurdJournals] WARNING: Character ID mismatch in deleteBaseline! Client sent: local_d_e_f, Server computed: 0_d_e.
[28-04-26 18:03:09.499] [BurdJournals] WARNING: No transferable recipes detected! authoritativeKnown=0 excludeStarting=false.
[28-04-26 18:06:10.282] [BurdJournals] WARNING: Character ID mismatch in deleteBaseline! Client sent: local_g_h_i, Server computed: 0_g_h.
[28-04-26 18:08:36.070] [BurdJournals] WARNING: No transferable recipes detected! authoritativeKnown=0 excludeStarting=false.

View File

@@ -0,0 +1,44 @@
<?php
namespace IndifferentKetchup\Codex\Test\Tests\Games\ProjectZomboid\Log;
use IndifferentKetchup\Codex\Detective\Detective;
use IndifferentKetchup\Codex\Log\File\PathLogFile;
use IndifferentKetchup\Codex\Log\Level;
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidBurdJournalsLog;
use PHPUnit\Framework\TestCase;
class ProjectZomboidBurdJournalsLogTest extends TestCase
{
private function fixturePath(): string
{
return __DIR__ . '/../../../../src/Games/ProjectZomboid/fixtures/burd-journals-minimal.txt';
}
public function testParsesEachLineAsAnEntry(): void
{
$log = (new ProjectZomboidBurdJournalsLog())->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());
}
}