From c032fd34b8964ae56ec5ee35fd07a47b8a813a0d Mon Sep 17 00:00:00 2001 From: indifferentketchup Date: Thu, 30 Apr 2026 20:31:12 +0000 Subject: [PATCH] Add ProjectZomboid log base classes ProjectZomboidLog (abstract): extends AnalysableLog, implements DetectableLogInterface. Centralises the PZ timestamp format ('d-m-y H:i:s.v') and UTC default timezone, plus a makePatternParser() helper so concrete subclasses only specify their line regex and capture group names. ProjectZomboidEventLog (abstract): marker base for the ten single-line structured PZ logs, distinct from the multi-line ProjectZomboidServerLog. Concrete subclasses follow. --- src/Log/ProjectZomboid/.gitkeep | 0 .../ProjectZomboid/ProjectZomboidEventLog.php | 14 +++++++++ src/Log/ProjectZomboid/ProjectZomboidLog.php | 31 +++++++++++++++++++ 3 files changed, 45 insertions(+) delete mode 100644 src/Log/ProjectZomboid/.gitkeep create mode 100644 src/Log/ProjectZomboid/ProjectZomboidEventLog.php create mode 100644 src/Log/ProjectZomboid/ProjectZomboidLog.php diff --git a/src/Log/ProjectZomboid/.gitkeep b/src/Log/ProjectZomboid/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/Log/ProjectZomboid/ProjectZomboidEventLog.php b/src/Log/ProjectZomboid/ProjectZomboidEventLog.php new file mode 100644 index 0000000..b817e00 --- /dev/null +++ b/src/Log/ProjectZomboid/ProjectZomboidEventLog.php @@ -0,0 +1,14 @@ + $matches Match-type constants in capture-group order + */ + protected static function makePatternParser(string $pattern, array $matches): PatternParser + { + return (new PatternParser()) + ->setPattern($pattern) + ->setMatches($matches) + ->setTimeFormat(static::TIME_FORMAT) + ->setTimezone(new DateTimeZone(static::DEFAULT_TIMEZONE)); + } +}