From a40b62f6ec7ecec250a0a28065837f93a4a830b3 Mon Sep 17 00:00:00 2001 From: Klaus Kneupner Date: Thu, 12 Nov 2026 18:18:07 +0100 Subject: [PATCH 1/2] test: rendering in Obsidian writes nothing to the console Obsidian asks plugins not to log. The released plugin printed the engine's DEBUG trace, including the DOT for every render. --- VGraphWasm/Tests-Browser/obsidian/smoke.spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/VGraphWasm/Tests-Browser/obsidian/smoke.spec.js b/VGraphWasm/Tests-Browser/obsidian/smoke.spec.js index 089962f..b2ab419 100644 --- a/VGraphWasm/Tests-Browser/obsidian/smoke.spec.js +++ b/VGraphWasm/Tests-Browser/obsidian/smoke.spec.js @@ -204,6 +204,21 @@ test('the settings tab is declared, so settings search can find it', async () => } }); +// Obsidian asks plugins not to log; the engine's debug output and Graphviz's +// warnings belong to neither the user nor the developer console. +test('rendering writes nothing to the console', async () => { + const logged = []; + const listen = (m) => logged.push(`${m.type()}: ${m.text()}`); + page.on('console', listen); + try { + await renderIn('moonstone'); + await renderIn('obsidian'); + } finally { + page.off('console', listen); + } + expect(logged).toEqual([]); +}); + test('no uncaught errors in the window', async () => { expect(pageErrors).toEqual([]); }); From 61d5fb6e6151f0ab036d6ab02474c04ef9249664 Mon Sep 17 00:00:00 2001 From: Klaus Kneupner Date: Thu, 12 Nov 2026 18:18:07 +0100 Subject: [PATCH 2/2] fix(wasm): log only errors to the console in release builds ConsoleLogger called console.log for log, warn and debug in every build, bypassing WASI, so a plugin could not silence it. Release builds ship in the plugins and now pass only errors on; debug builds keep the trace. --- VGraphWasm/VGraphEditor/ConsoleLogger.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/VGraphWasm/VGraphEditor/ConsoleLogger.swift b/VGraphWasm/VGraphEditor/ConsoleLogger.swift index 7d88cba..df511e7 100644 --- a/VGraphWasm/VGraphEditor/ConsoleLogger.swift +++ b/VGraphWasm/VGraphEditor/ConsoleLogger.swift @@ -4,9 +4,15 @@ import VGraph public struct ConsoleLogger: VForLogMessages { public init() {} + // Release builds ship inside the Obsidian and VS Code plugins, where nothing + // but errors belongs in the console (Obsidian's plugin guidelines). `warn` and + // `debug` arrive here too, so debug builds keep the whole trace and release + // builds only errors. public func log(_ message: String) { - let console = JSObject.global.console - _ = console.log(message) + #if DEBUG + let console = JSObject.global.console + _ = console.log(message) + #endif } public func error(_ message: String) {