Add config flag to log to console rather than Debug Logger extension, which for some reason is excruciatingly slow with multiple lines

With flag on, start up FF from command-line (e.g. /Applications/Firefox.app/Contents/MacOS/firefox) to use console
This commit is contained in:
Dan Stillman 2006-03-22 18:53:26 +00:00
parent f9b4aab08d
commit cf7cf17d7e

View file

@ -3,7 +3,8 @@ const SCHOLAR_CONFIG = {
DB_FILE: 'scholar.sqlite', DB_FILE: 'scholar.sqlite',
DB_VERSION: 2, DB_VERSION: 2,
DB_REBUILD: false, // erase DB and recreate from schema DB_REBUILD: false, // erase DB and recreate from schema
DEBUG_LOGGING: true DEBUG_LOGGING: true,
DEBUG_TO_CONSOLE: false // dump debug messages to console rather than (much slower) Debug Logger
}; };
/* /*
@ -51,19 +52,21 @@ var Scholar = new function(){
level = 3; level = 3;
} }
try { if (!SCHOLAR_CONFIG['DEBUG_TO_CONSOLE']){
var logManager = try {
var logManager =
Components.classes["@mozmonkey.com/debuglogger/manager;1"] Components.classes["@mozmonkey.com/debuglogger/manager;1"]
.getService(Components.interfaces.nsIDebugLoggerManager); .getService(Components.interfaces.nsIDebugLoggerManager);
var logger = logManager.registerLogger("Firefox Scholar"); var logger = logManager.registerLogger("Firefox Scholar");
}
catch (e){}
} }
catch (e){}
if (logger){ if (logger){
logger.log(level, message); logger.log(level, message);
} }
else { else {
dump('scholar(' + level + '): ' + message); dump('scholar(' + level + '): ' + message + "\n\n");
} }
return true; return true;
} }