contrib: Make log visualizer work with CI & pytest
What changed, and why it matters
This commit updates a standalone HTML helper tool used to visualize Core Lightning node logs. It adds logic to recognize log formats produced by continuous integration (CI) runs and Python tests, then strips the node-identifying prefix before rendering. There is no change to the actual Core Lightning daemon, wallet, network protocol, or any cryptographic code. It is a developer/debugging utility enhancement with no security relevance.
No security action required. This is a benign developer-tool improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies contrib/log_visualizer.html, a client-side log viewer. It adds detect_ci_logs(), detect_pytest_logs(), and detect_log_prefix() to build regular expressions matching ‘lightningd-N’ prefixes in CI/pytest log output, prompts the user when multiple nodes are present, and slices the matched prefix before passing the remainder to the existing parseLogLine() function. The code runs entirely in a browser on user-supplied log text and does not touch the lightningd binary, RPC interfaces, database, or protocol handling.
Changed components
contrib/log_visualizer.htmlInspect captured patch +52 / −0
diff --git a/contrib/log_visualizer.html b/contrib/log_visualizer.html
index b590a74d..7ebe1954 100644
--- a/contrib/log_visualizer.html
+++ b/contrib/log_visualizer.html
@@ -154,6 +154,48 @@ function filter_messages()
document.getElementById('filter_error').innerText = error.message;
}
}
+function detect_ci_logs(logs)
+{
+ nodes = new Set()
+ Array.from(logs.matchAll(/[0-9\-T:.Z]+ (lightningd-[0-9]+) /g)).forEach(match => {
+ nodes.add(match[1]);
+ });
+ var keys = [...nodes];
+ var node = keys.at(0);
+
+ if (nodes.size > 1) {
+ str = "Continous Integration log with multiple nodes detected.\n\nWhich would you like rendered?\n\nNodes detected:\n" + keys.join("\n");
+ node = prompt(str, keys[0]).trim();
+ }
+
+ return node ? new RegExp(`[0-9\-T:.Z]+ ${node} `, "g") : null;
+}
+function detect_pytest_logs(logs)
+{
+ nodes = new Set()
+ Array.from(logs.matchAll(/(lightningd-[0-9]+) /g)).forEach(match => {
+ nodes.add(match[1]);
+ });
+ var keys = [...nodes];
+ var node = keys.at(0);
+
+ if (nodes.size > 1) {
+ str = "Python Test log with multiple nodes detected.\n\nWhich would you like rendered?\n\nNodes detected:\n" + keys.join("\n");
+ node = prompt(str, keys[0]).trim();
+ }
+
+ return node ? new RegExp(`^${node} `, "g") : null;
+}
+function detect_log_prefix(logs)
+{
+ var ci = detect_ci_logs(logs)
+ if (ci)
+ return ci;
+ var pytest = detect_pytest_logs(logs)
+ if (pytest)
+ return pytest;
+ return null;
+}
function do_render(logs, area)
{
var d = document;
@@ -168,11 +210,21 @@ function do_render(logs, area)
while(sheet.cssRules.length)
sheet.deleteRule(0);
+ prefix = detect_log_prefix(logs);
+
for(line of logs.split("\n")) {
line = line.trim()
if(!line.length)
continue;
+ /* Detect and eat node prefix. If no prefix match, ignore line */
+ if (prefix) {
+ prefix_match = line.match(prefix);
+ if(!prefix_match)
+ continue;
+ line = line.slice(prefix_match[0].length);
+ }
+
info = parseLogLine(line);
if(info.msg.startsWith('Server started with public key'))
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.