fix(log-display): reverse log order to display newest first The
The applyLogStyling function in log.html has been updated to reverse the array of log lines. After parsing the JSON data, reversing the array ensures that the most recent logs appear at the top of the list. This change enhances the readability for users by displaying the logs in a descending chronological order.
This commit is contained in:
committed by
GitHub
parent
8793c36364
commit
f8d9fccf74
+2
-2
@@ -87,7 +87,7 @@
|
||||
|
||||
function applyLogStyling(jsonlines) {
|
||||
const KEYS = ['time', 'level', 'message'];
|
||||
const lines = JSON.parse('[' + jsonlines.trimEnd().replaceAll('\n', ',') + ']');
|
||||
const lines = JSON.parse('[' + jsonlines.trimEnd().replaceAll('\n', ',') + ']').reverse();
|
||||
return lines.map(line => {
|
||||
const ts = new Date(line['time']);
|
||||
const msg = Object.keys(line).reduce((msg, key) => {
|
||||
@@ -127,4 +127,4 @@
|
||||
}, 5000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user