From 5f2d52324295aa20cf277cc9df55875dcb54f9d4 Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Mon, 29 Apr 2024 15:03:22 +0300 Subject: [PATCH 1/2] feat(logging): enhance log visualization with level-specific colors - Add CSS classes for log levels (info, debug, error, trace, warn) in main.js to color-code log messages based on their severity. - Modify log.html to include the log level as a class in each log entry's table row for applying the corresponding color styles. --- www/log.html | 2 +- www/main.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/www/log.html b/www/log.html index fa5d3615..38e2b471 100644 --- a/www/log.html +++ b/www/log.html @@ -89,7 +89,7 @@ const msg = Object.keys(line).reduce((msg, key) => { return KEYS.indexOf(key) < 0 ? `${msg} ${key}=${line[key]}` : msg; }, line['message']); - return `${ts.toLocaleString()}${line['level']}${escapeHTML(msg)}`; + return `${ts.toLocaleString()}${escapeHTML(line['level'])}${escapeHTML(msg)}`; }).join(''); } diff --git a/www/main.js b/www/main.js index bb2bfec6..0aa9cb3d 100644 --- a/www/main.js +++ b/www/main.js @@ -131,6 +131,13 @@ body.dark-mode textarea::placeholder { body.dark-mode hr { border-top: 1px solid #444; } + +.info { color: #0174DF; } +.debug { color: #808080; } +.error { color: #DF0101; } +.trace { color: #585858; } +.warn { color: #FF9966; } +