From 57654bb426445b2d7383c97902ae1770144b5e84 Mon Sep 17 00:00:00 2001 From: Benjamin Braatz Date: Wed, 19 Jul 2023 01:14:07 +0200 Subject: [PATCH] Add times to Debug log. --- controlpi_plugins/web/Debug/controlpi-debug.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 }) } -- 2.34.1