slitaz-dev-tools rev 132

mirror-info: add color to log files
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Sep 06 11:08:12 2011 +0200 (2011-09-06)
parents b728f44da66f
children 18fc941c4169
files mirror-tools/mirror-info/index.php
line diff
     1.1 --- a/mirror-tools/mirror-info/index.php	Tue Sep 06 10:41:59 2011 +0200
     1.2 +++ b/mirror-tools/mirror-info/index.php	Tue Sep 06 11:08:12 2011 +0200
     1.3 @@ -329,7 +329,11 @@
     1.4  system("stat -c '%y %n' ".$file." | sed 's/.000000000//;s|/var/log/\(.*\).log|\\1.iso|'");
     1.5  echo "</a></h4>";
     1.6  echo "<pre>";
     1.7 -system("sed 's/.\[[0-9][^mG]*.//g;:a;s/^\(.\{1,68\}\)\(\[ [A-Za-z]* \]\)/\\1 \\2/;ta' < $file");
     1.8 +$sed_script="s/.\[[0-9][^mG]*.//g";
     1.9 +$sed_script.=";:a;s/^\(.\{1,68\}\)\(\[ [A-Za-z]* \]\)/\\1 \\2/;ta";
    1.10 +$sed_script.=";s#\[ OK \]#[ <span style=\"color:green\">OK</span> ]#";
    1.11 +$sed_script.=";s#\[ Failed \]#[ <span style=\"color:red\">Failed</span> ]#";
    1.12 +system("sed '".$sed_script."' < $file");
    1.13  echo "</pre>";
    1.14  }
    1.15