From f8d9fccf74314de8b34ef7b31ffb23132dadd5a9 Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Fri, 12 Jan 2024 07:43:12 +0300 Subject: [PATCH] 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. --- www/log.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/log.html b/www/log.html index 138b03f4..0eb1c4f3 100644 --- a/www/log.html +++ b/www/log.html @@ -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); - \ No newline at end of file +