format('Y-m-d'). $d->format('H:i:s') : "";
echo "
";
echo "$date | ";
echo '';
echo $d ? $d->format('u') : "";
echo ' | ';
echo "$comp | $peer | ";
echo "$level | $msg | ";
if ($level != "DEBUG")
{
echo '';
echo ' | ';
}
else
echo ' | ';
echo '
';
}
function render_rows ()
{
global $lines;
foreach ($lines as $line) {
render_row ($line[0], $line[1], $line[2], $line[3], $line[4], $line[5]);
}
}
function process ($line, $c)
{
global $lines;
global $peers;
global $comps;
$a = explode (' ', $line);
if (count($a) < 6)
return;
$date = DateTime::createFromFormat ("M d H:i:s-u", implode (' ', array_slice ($a, 0, 3)));
$component = $a[3];
$level = $a[4];
$msg = implode (' ', array_slice ($a, 5));
if (FALSE !== strpos($line, "STARTING SERVICE")) {
$id = preg_replace ("/.*\[(....)\].*\n/", '\1', $line);
$pid = preg_replace ("/.*[a-z-]*-([0-9]*).*\n/", '\1', $line);
$peers[$pid] = $id;
}
$lines[] = array ($date, $component, 0, $level, $msg, $c);
$comp = preg_replace ('/(.*)-\d*/', '\1', $component);
$comps[$comp] = 1;
}
if (array_key_exists ('a', $_GET)) {
$start = (int)$_GET['a'];
$ajax= TRUE;
}
else
{
$start = null;
}
if (array_key_exists ('z', $_GET)) {
$stop = (int)$_GET['z'];
$ajax= TRUE;
}
else
{
$stop = null;
}
$t0 = microtime(true);
$handle = @fopen($path, 'r');
if ($handle) {
$c = 0;
while (($line = fgets($handle)) !== false) {
if (!$start || $c >= $start) {
process ($line, $c);
}
$c++;
if ($stop && $c > $stop)
break;
}
} else {
echo "Error opening file $path.
";
}
$t1 = microtime(true);
/* Ajax request: don't render container HTML, just table rows. */
if ($start !== null || $stop !== null) {
render_rows();
die();
}
// echo $t1-$t0;
ksort($peers);
ksort($comps);
?>
GNUnet log view
Date Time |
uSec |
Comp |
Peer |
Level |
Message |
|
default
Processed in seconds.
Rendered in seconds.