From 9205205ecd52a1170192ad322fe750e183dd1998 Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 10 Jan 2025 18:25:39 -0500 Subject: [PATCH] Add line numbers back to web console --- src/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 0991569..48e02d8 100644 --- a/src/main.js +++ b/src/main.js @@ -91,17 +91,17 @@ function forwardConsole(fnName, dest) { const stackLines = error.stack.split("\n"); let message = args.join(" "); // Join all arguments into a single string + const location = stackLines[1].match(/([a-zA-Z0-9_-]+\.js:\d+)/); if (fnName === "error") { // Send the full stack trace for errors invoke(dest, { msg: `${message}\nStack trace:\n${stackLines.slice(1).join("\n")}` }); } else { // For other log levels, just extract the file and line number - const location = stackLines[stackLines.length - 1].match(/([a-zA-Z0-9_-]+\.js:\d+)/); invoke(dest, { msg: `${location ? location[0] : 'unknown'}: ${message}` }); } - original(...args); // Pass all arguments to the original console method + original(location ? location[0] : 'unknown', ...args); // Pass all arguments to the original console method }; }