Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MultiPatternDetector for all client logs and crash reports #88

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"require": {
"php": ">=8.1.0",
"aternos/codex": "^2.1.1",
"aternos/codex": "^2.2.0",
"ext-json": "*"
},
"require-dev": {
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/Log/Minecraft/Vanilla/Bukkit/Folia/FoliaCrashReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Bukkit\Folia;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
use Aternos\Codex\Minecraft\Log\Type\CrashReportLogTypeInterface;

Expand All @@ -21,6 +21,9 @@ class FoliaCrashReport extends FoliaLog implements CrashReportLogTypeInterface
*/
public static function getDetectors(): array
{
return [(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\s+Running: Folia version git-Folia/m")];
return [(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/")
->addPattern("/^\tRunning: Folia version git-Folia/m")
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Bukkit\Paper;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
use Aternos\Codex\Minecraft\Log\Type\CrashReportLogTypeInterface;

Expand All @@ -21,6 +21,9 @@ class PaperCrashReportLog extends PaperLog implements CrashReportLogTypeInterfac
*/
public static function getDetectors(): array
{
return [(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\s+Running: Paper version git-Paper/m")];
return [(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\s+Running: Paper version git-Paper/m")
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Bukkit\Purpur;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
use Aternos\Codex\Minecraft\Log\Type\CrashReportLogTypeInterface;

Expand All @@ -21,6 +21,9 @@ class PurpurCrashReportLog extends PurpurLog implements CrashReportLogTypeInterf
*/
public static function getDetectors(): array
{
return [(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\s+Running: Purpur version git-Purpur/m")];
return [(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\tRunning: Purpur version git-Purpur/m")
];
}
}
6 changes: 4 additions & 2 deletions src/Log/Minecraft/Vanilla/Fabric/FabricClientLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Fabric;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Log\Type\ClientLogTypeInterface;

/**
Expand All @@ -19,7 +19,9 @@ class FabricClientLog extends FabricLog implements ClientLogTypeInterface
public static function getDetectors(): array
{
return [
(new SinglePatternDetector())->setPattern('#^\[[\d:]+\] \[main\/INFO\](?:\:| \(FabricLoader/GameProvider\)) Loading Minecraft [^ \n]+ with Fabric Loader [^ \n]+(\n.*)*\n\[[\d:]+\] \[(?:Render thread|main)\/INFO\](?:\:| \(Minecraft\)) Setting user: \w+#m'),
(new MultiPatternDetector())
->addPattern('#^\[[\d:]+\] \[main\/INFO\](?:\:| \(FabricLoader/GameProvider\)) Loading Minecraft [^ \n]+ with Fabric Loader [^ \n]+#')
->addPattern('#^\[[\d:]+\] \[(?:Render thread|main)\/INFO\](?:\:| \(Minecraft\)) Setting user: \w+#m')
];
}
}
14 changes: 10 additions & 4 deletions src/Log/Minecraft/Vanilla/Fabric/FabricCrashReportLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Fabric;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\FabricCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
Expand All @@ -24,9 +24,15 @@ class FabricCrashReportLog extends FabricLog implements CrashReportLogTypeInterf
public static function getDetectors(): array
{
return [
(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\t(?:Known )?server brands?: fabric/im"),
(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\tIs Modded: Definitely; Client brand changed to 'fabric'/im"),
(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\tIs Modded: Definitely; Server brand changed to 'fabric'/im"),
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\t(?:Known )?server brands?: fabric$/im"),
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\tIs Modded: Definitely; Client brand changed to 'fabric'$/im"),
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\tIs Modded: Definitely; Server brand changed to 'fabric'$/im"),
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Forge\Arclight;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
use Aternos\Codex\Minecraft\Log\Type\CrashReportLogTypeInterface;

/**
* Class MohistCrashReportLog
* Class ArclightCrashReportLog
*
* @package Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Forge\Mohist
*/
Expand All @@ -22,8 +22,15 @@ class ArclightCrashReportLog extends ArclightLog implements CrashReportLogTypeIn
public static function getDetectors(): array
{
return [
(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\tKnown server brands:( [a-zA-Z])* arclight/m"),
(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\tIs Modded: Definitely; Server brand changed to 'arclight'/im")
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\t(?:Known )?server brands?: arclight/im"),
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\tIs Modded: Definitely; Client brand changed to 'arclight'$/im"),
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\tIs Modded: Definitely; Server brand changed to 'arclight'$/im"),
];
}
}
10 changes: 7 additions & 3 deletions src/Log/Minecraft/Vanilla/Forge/ForgeClientLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Forge;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Log\Type\ClientLogTypeInterface;

/**
Expand All @@ -19,8 +19,12 @@ class ForgeClientLog extends ForgeLog implements ClientLogTypeInterface
public static function getDetectors(): array
{
return [
(new SinglePatternDetector())->setPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: ModLauncher running: .*--fml.forgeVersion.*(\n.*)*\n\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Launching target \'(fml|forge)client\' with arguments.*$/m'),
(new SinglePatternDetector())->setPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Forge Mod Loader version.*(\n.*)*\n\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Launching wrapped minecraft \{net\.minecraft\.client/m')
(new MultiPatternDetector())
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: ModLauncher running: .*--fml.forgeVersion/m')
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Launching target \'(fml|forge)client\' with arguments/m'),
(new MultiPatternDetector())
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Forge Mod Loader version/m')
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Launching wrapped minecraft \{net\.minecraft\.client/m')
];
}
}
12 changes: 7 additions & 5 deletions src/Log/Minecraft/Vanilla/Forge/ForgeCrashReportLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Forge;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\ForgeCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
Expand All @@ -24,10 +24,12 @@ class ForgeCrashReportLog extends ForgeLog implements CrashReportLogTypeInterfac
public static function getDetectors(): array
{
return [
(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\tFML:/m"),
(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\tIs Modded: Definitely; Client brand changed to '(?:fml,)?forge'/im"),
(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\tIs Modded: Definitely; Server brand changed to '(?:fml,)?forge'/im"),

(new MultiPatternDetector())
->addPattern("/---- Minecraft Crash Report ----$/m")
->addPattern("/^\tIs Modded: Definitely; Client brand changed to '(?:fml,)?forge'/im"),
(new MultiPatternDetector())
->addPattern("/---- Minecraft Crash Report ----$/m")
->addPattern("/^\tIs Modded: Definitely; Server brand changed to '(?:fml,)?forge'/im"),
];
}

Expand Down
6 changes: 4 additions & 2 deletions src/Log/Minecraft/Vanilla/NeoForge/NeoForgeClientLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\NeoForge;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Log\Type\ClientLogTypeInterface;

class NeoForgeClientLog extends NeoForgeLog implements ClientLogTypeInterface
Expand All @@ -14,7 +14,9 @@ class NeoForgeClientLog extends NeoForgeLog implements ClientLogTypeInterface
public static function getDetectors(): array
{
return [
(new SinglePatternDetector())->setPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: ModLauncher running: .*--fml.neoForgeVersion.*(\n.*)*\n\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Launching target \'(fml|forge)client\' with arguments.*$/m')
(new MultiPatternDetector())
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: ModLauncher running: .*--fml.neoForgeVersion/m')
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Launching target \'(fml|forge)client\' with arguments/m'),
];
}
}
8 changes: 6 additions & 2 deletions src/Log/Minecraft/Vanilla/NeoForge/NeoForgeCrashReportLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\NeoForge;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\NeoForgeCrashReportAnalyser;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
Expand All @@ -18,7 +18,11 @@ class NeoForgeCrashReportLog extends NeoForgeLog implements CrashReportLogTypeIn
*/
public static function getDetectors(): array
{
return [(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\tNeoForge:/m")];
return [
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\tNeoForge: net\.neoforged:/m"),
];
}


Expand Down
6 changes: 4 additions & 2 deletions src/Log/Minecraft/Vanilla/Quilt/QuiltClientLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Quilt;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Log\Type\ClientLogTypeInterface;

/**
Expand All @@ -19,7 +19,9 @@ class QuiltClientLog extends QuiltLog implements ClientLogTypeInterface
public static function getDetectors(): array
{
return [
(new SinglePatternDetector())->setPattern('/\[[\d:]+\] \[main\/INFO\]: Loading Minecraft [^ \n]+ with Quilt Loader [^ \n]+(\n.*)*\n\[[\d:]+\] \[Render thread\/INFO\]: Setting user: \w+/'),
(new MultiPatternDetector())
->addPattern('/^\[[\d:]+\] \[main\/INFO\]: Loading Minecraft [^ \n]+ with Quilt Loader [^ \n]+/')
->addPattern('/^\[[\d:]+\] \[(?:Render thread|main)\/INFO\]: Setting user: \w+/m')
];
}
}
14 changes: 10 additions & 4 deletions src/Log/Minecraft/Vanilla/Quilt/QuiltCrashReportLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Quilt;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\QuiltCrashReportAnalyser;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
Expand All @@ -19,9 +19,15 @@ class QuiltCrashReportLog extends QuiltLog implements CrashReportLogTypeInterfac
public static function getDetectors(): array
{
return [
(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\t(?:Known )?server brands?: quilt/im"),
(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\tIs Modded: Definitely; Client brand changed to 'quilt'/im"),
(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----(\n.*)*\n\tIs Modded: Definitely; Server brand changed to 'quilt'/im")
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\t(?:Known )?server brands?: quilt/im"),
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\tIs Modded: Definitely; Client brand changed to 'quilt'$/im"),
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\tIs Modded: Definitely; Server brand changed to 'quilt'$/im"),
];
}

Expand Down
Loading