#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2023, Lime Technology
 * Copyright 2012-2023, Bergware International.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 */
?>
<?
echo "<p style='text-align:center'><span class='error label'>Error</span><span class='warn label'>Warning</span><span class='system label'>System</span></p>";
echo "<p style='text-align:center'><em>Transient errors in this log can be ignored unless you are having issues</em></p>\n";

$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/ColorCoding.php";

$log = "/var/log/gitflash";
if (file_exists($log) && filesize($log)) {
  $lines = file($log);

  foreach ($lines as $line) {
    $span = "span";
    foreach ($match as $type) foreach ($type['text'] as $text) if (preg_match("/$text/i",$line)) {$span = "span class='{$type['class']}'"; break 2;}
    echo "<$span>".htmlspecialchars(trim($line))."\n</span>";
  }
}

?>