77
88class ReportParser extends \Aternos \Codex \Parser \Parser
99{
10- protected const string LEVEL_INFO = "info " ;
11- protected const string LEVEL_WARNING = "warn " ;
12- protected const string LEVEL_TITLE = "title " ;
13- protected const string LEVEL_COMMENT = "comment " ;
14- protected const string LEVEL_STACKTRACE = "stacktrace " ;
1510
16- protected const string DEFAULT_LEVEL = self :: LEVEL_INFO ;
11+ protected const ReportLevel DEFAULT_LEVEL = ReportLevel:: INFO ;
1712
1813 /**
1914 * @var array<string, array<string>> Regular expression patterns to match log lines to levels
2015 */
2116 protected const array PATTERN = [
22- self :: LEVEL_WARNING => ["/\s*WARNING: .*$/ " ],
23- self :: LEVEL_STACKTRACE => ["/^\s+at (?:\w+\/+)?\S+\(.+\)$/ " , "/^(?:Caused by: )?[a-z]+\.(?:\w+\.?)+: .*$/ " , "/^ \\tat [a-z]+\..*$/ " ],
24- self :: LEVEL_INFO => ["/^([^|:]+:) .+$/ " , "/^(\w+:)$/ " , "/^( \\t[^:.]+:)$/ " ],
25- self :: LEVEL_TITLE => ["/^-{2,4} .* -{2,4}$/ " ],
26- self :: LEVEL_COMMENT => ["/\/\/.*$/ " ],
17+ ReportLevel:: WARNING -> value => ["/\s*WARNING: .*$/ " ],
18+ ReportLevel:: STACKTRACE -> value => ["/^\s+at (?:\w+\/+)?\S+\(.+\)$/ " , "/^(?:Caused by: )?[a-z]+\.(?:\w+\.?)+: .*$/ " , "/^ \\tat [a-z]+\..*$/ " ],
19+ ReportLevel:: INFO -> value => ["/^([^|:]+:) .+$/ " , "/^(\w+:)$/ " , "/^( \\t[^:.]+:)$/ " ],
20+ ReportLevel:: TITLE -> value => ["/^-{2,4} .* -{2,4}$/ " ],
21+ ReportLevel:: COMMENT -> value => ["/\/\/.*$/ " ],
2722 ];
2823
2924 /**
@@ -46,7 +41,7 @@ public function parse(): void
4641 }
4742 continue 3 ;
4843 }
49- $ entry ->setLevel (ReportLevel:: fromString ( static ::DEFAULT_LEVEL ) );
44+ $ entry ->setLevel (static ::DEFAULT_LEVEL );
5045 }
5146 }
5247 }
0 commit comments