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.
This commit is contained in:
Dan Stillman 2014-03-06 16:23:21 -05:00
parent 5ddfdec584
commit b486366fdf

View file

@ -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);
}