From b486366fdf0b61561b3befebac8ebff69c7f2f6c Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 6 Mar 2014 16:23:21 -0500 Subject: [PATCH] Log debug output to the Browser Console on Windows At least for me (in a VM), the text console has always been unusable on Windows. Logging to the Browser Console is slower than dump() on OS X and Linux, but on Windows it's much faster. --- chrome/content/zotero/xpcom/debug.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/debug.js b/chrome/content/zotero/xpcom/debug.js index 7db32ac09..4bfef5ae0 100644 --- a/chrome/content/zotero/xpcom/debug.js +++ b/chrome/content/zotero/xpcom/debug.js @@ -106,7 +106,18 @@ Zotero.Debug = new function () { if (_console) { var output = 'zotero(' + level + ')' + (_time ? deltaStr : '') + ': ' + message; if(Zotero.isFx && !Zotero.isBookmarklet) { - dump(output+"\n\n"); + // On Windows, where the text console is inexplicably glacial, + // log to the Browser Console instead + // + // TODO: Get rid of the filename and line number + if (Zotero.isWin) { + const consoleJSM = Components.utils.import("resource://gre/modules/devtools/Console.jsm", {}); + consoleJSM.console.sendConsoleAPIMessage(output); + } + // Otherwise dump to the text console + else { + dump(output + "\n\n"); + } } else if(window.console) { window.console.log(output); }