PZ build 42.x dropped the per-line `t:` (microsecond) field and tightened the spacing between `f:N`, `t:N`, and `st:N,N,N,N>` markers. The hardcoded `f:\d+,\s+t:\d+,\s+st:` requirement caused every B42 line to fail the parser's LINE regex, leaving ServerLog entries without their level/prefix and silently disabling ServerExceptionProblem and ModMissingProblem (the anchorless EngineVersionInformation still fired against the joined entry text, which is why the symptom was "one Information, no Problems"). Make `t:N,` optional via `(?:,\s+t:\d+)?` and the comma between `f:N` and `st:` optional via `,?`. The B41 format remains a strict match. Add `debug-server-42x-minimal.txt` mirroring the existing synthetic fixture in the new format, and parameterise ProjectZomboidServerLogTest with a #[DataProvider] so all four parser-shape assertions now run against both formats. Spot-check: analysers emit 3 Problems (2 exceptions, 1 missing mod) and 4 Information entries against the new fixture, identical to B41. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
30 lines
1.2 KiB
PHP
30 lines
1.2 KiB
PHP
<?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/';
|
|
|
|
public const string EXCEPTION = '/^\[\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\][^\n]+Exception thrown\n\t(?<type>[A-Za-z0-9_.$]+(?:Exception|Error))[^\n]*(?<body>(?:\n\t.+)*)/';
|
|
}
|