Skip to content

Commit

Permalink
Change logs timestamp format in WebUI
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed May 27, 2024
1 parent 8cb513c commit 649de01
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions www/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<table>
<thead>
<tr>
<th style="width: 130px">Time</th>
<th style="width: 100px">Time</th>
<th style="width: 40px">Level</th>
<th>Message</th>
</tr>
Expand Down Expand Up @@ -98,11 +98,16 @@
lines = lines.reverse();
}
return lines.map(line => {
const ts = new Date(line['time']);
const ts = new Date(line['time']).toLocaleString(undefined, {
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
fractionalSecondDigits: 3
});
const msg = Object.keys(line).reduce((msg, key) => {
return KEYS.indexOf(key) < 0 ? `${msg} ${key}=${line[key]}` : msg;
}, line['message']);
return `<tr class="${line['level']}"><td>${ts.toLocaleString()}</td><td>${escapeHTML(line['level'])}</td><td>${escapeHTML(msg)}</td></tr>`;
return `<tr class="${line['level']}"><td>${ts}</td><td>${line['level']}</td><td>${escapeHTML(msg)}</td></tr>`;
}).join('');
}

Expand Down

0 comments on commit 649de01

Please sign in to comment.