5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1">
8 <title>GNUnet log view</title>
10 <!-- Latest compiled and minified Bootstrap CSS -->
11 <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
12 <!-- Optional theme -->
13 <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css">
17 font-family: arial,sans-serif;
21 text-decoration: none;
26 border-collapse:collapse;
32 background-color:#CCC;
46 <th class="level">Level</th>
54 function render_row ($d, $component, $pid, $level, $msg)
56 $date = $d->format('Y-m-d'). '<br />' . $d->format('H:i:s');
57 echo "<tr class=\"$level\">";
58 echo "<td class=\"date\">$date</td>";
59 echo '<td class="usec">';
62 echo "<td class=\"comp\">$component</td><td class=\"level\">$level</td><td>$msg </td>";
63 echo '<td><button class="btn btn-xs btn-default btn-show"><span class="glyphicon glyphicon-plus"></span></button>';
64 echo '<button class="btn btn-xs btn-default btn-hide"><span class="glyphicon glyphicon-minus"></span></button></td></tr>';
68 function process ($line)
70 $a = explode (' ', $line);
71 $date = DateTime::createFromFormat ("M d H:i:s-u", implode (' ', array_slice ($a, 0, 3)));
74 $msg = implode (' ', array_slice ($a, 5));
76 render_row ($date, $component, 0, $level, $msg);
80 $handle = @fopen($path, 'r');
82 while (($line = fgets($handle)) !== false) {
86 echo "<div class=\"alert alert-danger\">Error opening file $path.</div>";
93 <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
94 <!-- Latest compiled and minified Bootstrap JavaScript -->
95 <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
101 var tr = $(btn).parents("tr");
102 tr.nextUntil("."+tr.attr("class")).show();
108 var tr = $(btn).parents("tr");
109 tr.nextUntil("."+tr.attr("class")).hide();
115 $(".btn-show").on ("click", function(){ show(this) });
116 $(".btn-hide").on ("click", function(){ hide(this) });
117 console.log( "ready!" );