X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=contrib%2Flog.php;h=b2ca9ed6cde69f7cd88386b6851ba249532b7bf2;hb=9a112a7aa7c1703a9489da7306293ee1b9df7331;hp=2ecf1b075955e03a2faef4432d15ef29ea0dd7fe;hpb=b05f8c9e5092ffb8937cc0bcf2913dd78a118cae;p=oweals%2Fgnunet.git
diff --git a/contrib/log.php b/contrib/log.php
index 2ecf1b075..b2ca9ed6c 100644
--- a/contrib/log.php
+++ b/contrib/log.php
@@ -3,7 +3,12 @@
$path='log';
$lines = array();
$peers = array();
+$comps = array();
$ajax = FALSE;
+$colors = array('#F00', '#F80', '#FF0',
+ '#4F0', '#0A0',
+ '#22F', '#ADF', '#0FF', '#F0F', '#508', '#FAA',
+ '#FFF', '#AAA', '#666', '#222');
function render_row ($d, $component, $pid, $level, $msg, $c)
{
@@ -15,18 +20,17 @@ function render_row ($d, $component, $pid, $level, $msg, $c)
list($comp,$peer) = explode (',', preg_replace ('/(.*)-(\d*)/', '\1,\2', $component));
$peer = array_key_exists ($peer, $peers) ? $peers[$peer] : $peer;
$date = $d ? $d->format('Y-m-d'). $d->format('H:i:s') : "";
- echo "
";
+ echo "
";
echo "$date | ";
echo '';
echo $d ? $d->format('u') : "";
echo ' | ';
echo "$comp | $peer | ";
- echo "$level | $msg | ";
+ echo "$level | $msg | ";
if ($level != "DEBUG")
{
echo '';
echo ' | ';
-// echo '';
}
else
echo ' | ';
@@ -45,6 +49,7 @@ function process ($line, $c)
{
global $lines;
global $peers;
+ global $comps;
$a = explode (' ', $line);
if (count($a) < 6)
return;
@@ -60,6 +65,8 @@ function process ($line, $c)
}
$lines[] = array ($date, $component, 0, $level, $msg, $c);
+ $comp = preg_replace ('/(.*)-\d*/', '\1', $component);
+ $comps[$comp] = 1;
}
if (array_key_exists ('a', $_GET)) {
@@ -95,12 +102,14 @@ if ($handle) {
}
$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);
?>
@@ -119,13 +128,19 @@ if ($start !== null || $stop !== null) {
@@ -165,15 +193,22 @@ if ($start !== null || $stop !== null) {
-
-
+
+
-
+
$id): ?>
-
+
+
+
+
+
+
+ $one): ?>
+
-
-
+
+
@@ -191,8 +226,10 @@ if ($start !== null || $stop !== null) {
-
+ default
+Processed in seconds.
+Rendered in seconds.
@@ -201,6 +238,7 @@ if ($start !== null || $stop !== null) {