Change logs timestamp format in WebUI
This commit is contained in:
+8
-3
@@ -56,7 +56,7 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 130px">Time</th>
|
<th style="width: 100px">Time</th>
|
||||||
<th style="width: 40px">Level</th>
|
<th style="width: 40px">Level</th>
|
||||||
<th>Message</th>
|
<th>Message</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -98,11 +98,16 @@
|
|||||||
lines = lines.reverse();
|
lines = lines.reverse();
|
||||||
}
|
}
|
||||||
return lines.map(line => {
|
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) => {
|
const msg = Object.keys(line).reduce((msg, key) => {
|
||||||
return KEYS.indexOf(key) < 0 ? `${msg} ${key}=${line[key]}` : msg;
|
return KEYS.indexOf(key) < 0 ? `${msg} ${key}=${line[key]}` : msg;
|
||||||
}, line['message']);
|
}, 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('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user