Add ProjectZomboidServerLog (DebugLog-server.txt)

Concrete Log subclass for the engine debug log. Captures time, level,
and subsystem prefix per entry; stack-trace continuation lines attach
to the triggering ERROR entry via PatternParser's append-on-no-match
behaviour. Detectors: filename match on DebugLog-server.txt plus two
content signatures (the version=X.Y.Z+hash banner and the level/
subsystem/f/t/st header shape). Pattern constants live in
src/Pattern/ProjectZomboid/DebugServerPattern.php with named groups
ready for analyser use in phase B. Synthetic fixture under
test/src/Games/ProjectZomboid/fixtures/ uses zeroed identifiers and
placeholder paths.
This commit is contained in:
2026-04-30 20:34:03 +00:00
parent c032fd34b8
commit d863fae9e6
5 changed files with 170 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace IndifferentKetchup\Codex\Pattern\ProjectZomboid;
/**
* Regex constants for the Project Zomboid DebugLog-server.txt format.
*
* LINE captures, in order:
* 1. time (DD-MM-YY HH:MM:SS.mmm)
* 2. level (LOG | WARN | ERROR | INFO | DEBUG)
* 3. prefix (subsystem name, e.g. General, Mod, WorldGen)
*
* The f:/t:/st: metadata and trailing message body are intentionally not
* captured by the parser; analyzers reach into the Line raw text directly.
*/
class DebugServerPattern
{
public const string LINE = '/^\[(\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3})\]\s+(\w+)\s*:\s+(\S+)\s+f:\d+,\s+t:\d+,\s+st:[\d,]+>\s+.*$/';
public const string VERSION = '/version=(?<version>\S+) (?<hash>[a-f0-9]{40}) (?<date>\d{4}-\d{2}-\d{2}) (?<time>\d{2}:\d{2}:\d{2})/';
public const string MOD_LOAD = '/loading (?<mod>[A-Za-z0-9_]+)\.?$/';
public const string MOD_MISSING = '/required mod "(?<mod>[^"]+)" not found/';
public const string EXCEPTION_HEADER = '/^\[\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\]\s+ERROR:.*Exception thrown/';
}