Restore use of dump() on Windows if debug pref is enabled

It turns out that the Cygwin console, unlike -console, is actually
usable, so developers on Windows can use that. Since we sometimes need
real-time debug output from end users (who won't have Cygwin installed),
keep logging to the Browser Console if only the -ZoteroDebug flag is
passed.
This commit is contained in:
Dan Stillman 2015-03-24 03:40:07 -04:00
parent 827eb9b32e
commit d1ca5e2729

View File

@ -25,10 +25,11 @@
Zotero.Debug = new function () {
var _console, _stackTrace, _store, _level, _time, _lastTime, _output = [];
var _console, _consolePref, _stackTrace, _store, _level, _time, _lastTime, _output = [];
this.init = function (forceDebugLog) {
_console = forceDebugLog || Zotero.Prefs.get('debug.log');
_consolePref = Zotero.Prefs.get('debug.log');
_console = _consolePref || forceDebugLog;
_store = Zotero.Prefs.get('debug.store');
if (_store) {
Zotero.Prefs.set('debug.store', false);
@ -89,11 +90,12 @@ Zotero.Debug = new function () {
if (_console) {
var output = 'zotero(' + level + ')' + (_time ? deltaStr : '') + ': ' + message;
if(Zotero.isFx && !Zotero.isBookmarklet) {
// On Windows, where the text console is inexplicably glacial,
// log to the Browser Console instead
// On Windows, where the text console (-console) is inexplicably glacial,
// log to the Browser Console instead if only the -ZoteroDebug flag is used.
// Developers can use the debug.log/debug.time prefs and the Cygwin text console.
//
// TODO: Get rid of the filename and line number
if (Zotero.isWin && !Zotero.isStandalone) {
if (!_consolePref && Zotero.isWin && !Zotero.isStandalone) {
var console = Components.utils.import("resource://gre/modules/devtools/Console.jsm", {}).console;
console.log(output);
}