Added color coding in log files

This commit is contained in:
bergware
2022-05-28 21:03:04 +02:00
parent 06d8ffd939
commit 89114f2688

View File

@@ -27,11 +27,9 @@ $cmd = popen(implode(' ',array_map('escapeshellarg',$argv)),'r');
foreach ($color as $cat => $val) echo $val,$cat,$last," "; echo "\n\n";
while (($line = fgets($cmd))!==false) {
$lead = $last;
foreach ($match as $type) foreach ($type['text'] as $text) {
if (preg_match("/$text/i",$line)) {
$lead = $color[$type['class']];
break 2;
}
foreach ($match as $type) foreach ($type['text'] as $text) if (preg_match("/$text/i",$line)) {
$lead = $color[$type['class']];
break 2;
}
echo $lead,rtrim($line,"\n"),$last,"\n";
}