From: Benjamin Braatz Date: Tue, 18 Jul 2023 23:14:07 +0000 (+0200) Subject: Add times to Debug log. X-Git-Tag: v0.3.0~2 X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=57654bb426445b2d7383c97902ae1770144b5e84;p=graphit%2Fcontrolpi-wsserver.git Add times to Debug log. --- diff --git a/controlpi_plugins/web/Debug/controlpi-debug.js b/controlpi_plugins/web/Debug/controlpi-debug.js index f6e0622..ca612d1 100644 --- a/controlpi_plugins/web/Debug/controlpi-debug.js +++ b/controlpi_plugins/web/Debug/controlpi-debug.js @@ -18,6 +18,8 @@ function connect() { container.removeChild(container.lastChild); } const log = document.getElementById('web-debug-log') + const time = new Date().toLocaleTimeString() + log.innerHTML += time + ":
" log.innerHTML += `Connection closed: ${e.reason}
` if (timeout < 8000) { timeout *= 2 @@ -30,6 +32,8 @@ function connect() { }) ws.addEventListener('error', function (e) { const log = document.getElementById('web-debug-log') + const time = new Date().toLocaleTimeString() + log.innerHTML += time + ":
" log.innerHTML += `Error: ${e.message}
` log.innerHTML += "Closing connection …
" log.scrollTop = log.scrollHeight @@ -45,7 +49,9 @@ function connect() { processClientMessage(message) } const log = document.getElementById('web-debug-log') - log.innerHTML += JSON.stringify(message, null, 4) + '
' + const time = new Date().toLocaleTimeString() + log.innerHTML += time + ":
" + log.innerHTML += JSON.stringify(message, null, 4) + "
" log.scrollTop = log.scrollHeight }) }