Adjust order of log function to reduce unneccesary things

This commit is contained in:
Fred Boniface 2023-03-30 20:46:53 +01:00
parent cd3384ece8
commit 9a7797ce20
2 changed files with 1 additions and 4 deletions

View File

@ -33,15 +33,14 @@ const delay = ms => new Promise(res => setTimeout(res, ms));
/* Log Helper */ /* Log Helper */
/* Values for level: 1, 2, 3 */
/* Maintains backwards compatibility for previous /* Maintains backwards compatibility for previous
implementation of log helper */ implementation of log helper */
async function log(msg, type) { async function log(msg, type) {
var time = new Date().toISOString();
const mode = "prod" const mode = "prod"
if (mode === "prod" && type != "ERR") { if (mode === "prod" && type != "ERR") {
return; return;
} }
var time = new Date().toISOString();
switch (type) { switch (type) {
case "ERR": case "ERR":
console.error(`${time} - ${msg}`); console.error(`${time} - ${msg}`);

View File

@ -11,13 +11,11 @@ async function get() {
} }
async function display(data) { async function display(data) {
console.log(JSON.stringify(data))
document.getElementById('server_host').textContent = data.host; document.getElementById('server_host').textContent = data.host;
document.getElementById('server_mode').textContent = data.mode || "Unknown"; document.getElementById('server_mode').textContent = data.mode || "Unknown";
document.getElementById('ver-bkend').textContent = data.verBkend || "Unknown"; document.getElementById('ver-bkend').textContent = data.verBkend || "Unknown";
let dat = data.dat[0] let dat = data.dat[0]
let ver = data.ver[0] let ver = data.ver[0]
console.log(JSON.stringify(dat))
document.getElementById('time').textContent = await convertUnixLocal(dat.since); document.getElementById('time').textContent = await convertUnixLocal(dat.since);
document.getElementById('ldbws').textContent = dat.ldbws || "0"; document.getElementById('ldbws').textContent = dat.ldbws || "0";
document.getElementById('ldbsvws').textContent = dat.ldbsvws || "0"; document.getElementById('ldbsvws').textContent = dat.ldbsvws || "0";