diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/log.php | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/contrib/log.php b/contrib/log.php index 00f49f83b..4e408fff6 100644 --- a/contrib/log.php +++ b/contrib/log.php | |||
@@ -4,6 +4,7 @@ $path='log'; | |||
4 | $lines = array(); | 4 | $lines = array(); |
5 | $peers = array(); | 5 | $peers = array(); |
6 | $ajax = FALSE; | 6 | $ajax = FALSE; |
7 | $colors = array('#F00', '#0C0', '#44F', '#FF0', '#F0F', '#0FF'); | ||
7 | 8 | ||
8 | function render_row ($d, $component, $pid, $level, $msg, $c) | 9 | function render_row ($d, $component, $pid, $level, $msg, $c) |
9 | { | 10 | { |
@@ -15,7 +16,7 @@ function render_row ($d, $component, $pid, $level, $msg, $c) | |||
15 | list($comp,$peer) = explode (',', preg_replace ('/(.*)-(\d*)/', '\1,\2', $component)); | 16 | list($comp,$peer) = explode (',', preg_replace ('/(.*)-(\d*)/', '\1,\2', $component)); |
16 | $peer = array_key_exists ($peer, $peers) ? $peers[$peer] : $peer; | 17 | $peer = array_key_exists ($peer, $peers) ? $peers[$peer] : $peer; |
17 | $date = $d ? $d->format('Y-m-d'). $d->format('H:i:s') : ""; | 18 | $date = $d ? $d->format('Y-m-d'). $d->format('H:i:s') : ""; |
18 | echo "<tr class=\"$level $peer\" id=\"$c\">"; | 19 | echo "<tr class=\"$level P-$peer\" id=\"$c\">"; |
19 | echo "<td class=\"date\"><small>$date</td>"; | 20 | echo "<td class=\"date\"><small>$date</td>"; |
20 | echo '<td class="usec"><small>'; | 21 | echo '<td class="usec"><small>'; |
21 | echo $d ? $d->format('u') : ""; | 22 | echo $d ? $d->format('u') : ""; |
@@ -118,8 +119,8 @@ if ($start !== null || $stop !== null) { | |||
118 | 119 | ||
119 | <style> | 120 | <style> |
120 | body { | 121 | body { |
121 | font-family: arial,sans-serif; | 122 | font-family: courier,sans-serif; |
122 | /* color:#444; */ | 123 | color:#000; |
123 | } | 124 | } |
124 | table { | 125 | table { |
125 | margin-top: 40px; | 126 | margin-top: 40px; |
@@ -152,10 +153,19 @@ if ($start !== null || $stop !== null) { | |||
152 | .btn-group { | 153 | .btn-group { |
153 | min-width: 48px; | 154 | min-width: 48px; |
154 | } | 155 | } |
155 | table.table tbody tr td { | 156 | table.table tbody tr td, |
156 | padding: 0px 0px 0px 4px; | 157 | table.table tbody th td { |
158 | padding: 0px 0px 0px 2px; | ||
157 | margin-bottom: 0px; | 159 | margin-bottom: 0px; |
158 | } | 160 | } |
161 | <?php | ||
162 | $c = 0; | ||
163 | foreach ($peers as $peer) { | ||
164 | echo "table.table tbody tr.P-$peer td.peer {\n"; | ||
165 | echo ' background-color: ' . $colors[$c] . ";\n"; | ||
166 | echo "}\n"; | ||
167 | echo "#P-$peer { color: " . $colors[$c++] . "}\n"; | ||
168 | } ?> | ||
159 | </style> | 169 | </style> |
160 | </head> | 170 | </head> |
161 | 171 | ||
@@ -170,7 +180,7 @@ if ($start !== null || $stop !== null) { | |||
170 | </div> | 180 | </div> |
171 | <div class="btn-group"> | 181 | <div class="btn-group"> |
172 | <?php foreach($peers as $pid=>$id): ?> | 182 | <?php foreach($peers as $pid=>$id): ?> |
173 | <button id="<?php echo $id ?>" class="btn btn-default btn-showpeer active"><?php echo $id ?></button> | 183 | <button id="P-<?php echo $id ?>" class="btn btn-default btn-showpeer active"><?php echo $id ?></button> |
174 | <?php endforeach ?> | 184 | <?php endforeach ?> |
175 | <button id="btn-showall" class="btn btn-default">All</button> | 185 | <button id="btn-showall" class="btn btn-default">All</button> |
176 | <button id="btn-shownone" class="btn btn-default">None</button> | 186 | <button id="btn-shownone" class="btn btn-default">None</button> |
@@ -218,7 +228,7 @@ if ($start !== null || $stop !== null) { | |||
218 | $("#"+level).addClass("active"); | 228 | $("#"+level).addClass("active"); |
219 | for (var index = 0; index < types.length; ++index) { | 229 | for (var index = 0; index < types.length; ++index) { |
220 | $(".btn-showpeer.active").each(function(){ | 230 | $(".btn-showpeer.active").each(function(){ |
221 | $("."+types[index]+"."+this.id).show(); | 231 | $("."+types[index]+".P-"+this.id).show(); |
222 | }); | 232 | }); |
223 | if (types[index] == level) | 233 | if (types[index] == level) |
224 | return; | 234 | return; |
@@ -289,7 +299,7 @@ if ($start !== null || $stop !== null) { | |||
289 | var trs = $(resp); | 299 | var trs = $(resp); |
290 | for (var peer in peers) { | 300 | for (var peer in peers) { |
291 | console.log (peer + "=>" + peers[peer]); | 301 | console.log (peer + "=>" + peers[peer]); |
292 | trs.filter("."+peer).removeClass(peer).addClass(peers[peer]).find("td.peer").html(peers[peer]); | 302 | trs.filter(".P-"+peer).removeClass('P-'+peer).addClass('P-'+peers[peer]).find("td.peer").html(peers[peer]); |
293 | } | 303 | } |
294 | console.log (trs); | 304 | console.log (trs); |
295 | if (loc.length > 0) | 305 | if (loc.length > 0) |