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:
Sergey Krashevich
2024-01-12 07:43:12 +03:00
committed by GitHub
parent 8793c36364
commit f8d9fccf74
+2 -2
View File
@@ -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>