Skip to content

Commit

Permalink
www: log: Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
nebkat committed Oct 31, 2019
1 parent 0cbcb06 commit 16ce743
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions www/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@
<style>
#table tbody {
font-family: "Courier New", Courier, monospace;
white-space: pre;
}

#table tbody td {
padding-top: 3px;
padding-bottom: 3px;
}
</style>
<script>
$(function() {
var table = $("#table");
var tbody = table.find('tbody');

var regex = /(?<level>[VDIWE]) \((?<time>\d+)\) (?<tag>[a-zA-Z_-]+): (?<comment>.*)/;
var regex = /(?<level>[VDIWE]) \((?<time>[\d:.]+)\) (?<tag>[a-zA-Z_-]+): (?<comment>.*)/;

var update = function() {
$.get('log', function(data) {
Expand All @@ -25,9 +31,10 @@
setTimeout(update, 2500);

for (var line of lines) {

var match = line.match(regex);

if (match === null && !line.empty()) {
if (match === null) {
console.log("Discarded: " + line);
continue;
}
Expand Down Expand Up @@ -69,7 +76,7 @@
</script>
</head>
<body class="bg-light">
<div class="container">
<div class="container-fluid">
<div class="pt-5 text-center">
<h2>ESP32 XBee Log</h2>
<p class="lead">The device log will be loaded automatically below. Make sure that you have at most one log page open at a time. </p>
Expand Down

0 comments on commit 16ce743

Please sign in to comment.