diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-05-05 12:27:10 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-06-05 14:52:35 +0200 |
commit | da49b6460ae02a1a1f0e86aef8f541798730a18f (patch) | |
tree | a2c02abdd37fdff33ae4a2b7a3e989f8312a6261 | |
parent | c603f0a1a2985bf225786122beeaf248ca87cd99 (diff) | |
download | bugzilla-triage-da49b6460ae02a1a1f0e86aef8f541798730a18f.tar.gz |
Make my console.myDebug configurable via about:config preference.
That is the Boolean variable bugzilla-triage.setting.debug
-rw-r--r-- | data/lib/bzpage.js | 4 | ||||
-rw-r--r-- | data/lib/util.js | 9 | ||||
-rw-r--r-- | data/rhlib/rhbzpage.js | 3 | ||||
-rw-r--r-- | lib/libbugzilla.js | 24 |
4 files changed, 24 insertions, 16 deletions
diff --git a/data/lib/bzpage.js b/data/lib/bzpage.js index d957bd3..296fe29 100644 --- a/data/lib/bzpage.js +++ b/data/lib/bzpage.js @@ -22,7 +22,7 @@ var equivalentComponents = null; * central handler processing messages from the main script. */ self.on('message', function onMessage(msg) { - console.log("onMessage - incoming : msg.cmd = " + msg.cmd); + console.myDebug("onMessage - incoming : msg.cmd = " + msg.cmd); switch (msg.cmd) { case "ReloadThePage": document.location.reload(true); @@ -80,7 +80,7 @@ function executeCommand(cmdObj) { * Object with the appropriate parameters for the command */ function centralCommandDispatch (cmdLabel, cmdParams) { - console.log("centralCommandDispatch : cmdLabel = " + cmdLabel); + console.myDebug("centralCommandDispatch : cmdLabel = " + cmdLabel); switch (cmdLabel) { case "name": case "position": diff --git a/data/lib/util.js b/data/lib/util.js index dc927b6..11cf3bc 100644 --- a/data/lib/util.js +++ b/data/lib/util.js @@ -375,11 +375,10 @@ NotLoggedinException.prototype.toString = function () { return this.name + ': "' + this.message + '"'; }; -// Are we debugging? -var debugFlag = true; - console.myDebug = function myDebug(str) { - if (debugFlag) { - console.log(str); + if (typeof config !== "undefined") { + if (config.debuggingVerbose) { + console.log(str); + } } }; diff --git a/data/rhlib/rhbzpage.js b/data/rhlib/rhbzpage.js index 752e471..55314d5 100644 --- a/data/rhlib/rhbzpage.js +++ b/data/rhlib/rhbzpage.js @@ -131,7 +131,6 @@ function RHcentralCommandDispatch(cmdLabel, cmdParams) { markBugTriaged(); break; case "chipMagic": - console.myDebug("cmdParams = " + cmdParams.toSource()); fillInWhiteBoard(cmdParams); break; // If we don't have it here, call superclass method @@ -254,7 +253,6 @@ function fillInChipMagic(XlogID) { function chipsetMagic (interestingLineArr) { // parse Xorg.0.log var cardStr = ""; - console.myDebug("interestingLineArr = " + interestingLineArr.toSource()); console.myDebug("interestingLineArr[1] = " + interestingLineArr[1]); if (interestingLineArr.length >0) { @@ -499,6 +497,7 @@ function RHBZinit() { // Xorg.0.log must be text, otherwise we cannot parse it return (/[xX].*log/.test(value[0]) && /text/.test(value[2])); }); + // Just add a link to every Xorg.0.log link analyzing it. addCheckXorgLogLink(XorgLogAttList); diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js index 3763eff..990c759 100644 --- a/lib/libbugzilla.js +++ b/lib/libbugzilla.js @@ -329,13 +329,13 @@ exports.makeJSONRPCCall = function makeJSONRPCCall(url, method, params, callback "params": params }; - console.myDebug("makeJSONRPCCall: out = " + JSON.stringify(msg)); +// console.log("makeJSONRPCCall: out = " + JSON.stringify(msg)); Request({ url: url, onComplete: function(response) { if (response.status == 200) { - console.myDebug("makeJSONRPCCall: in = " + response.text); +// console.log("makeJSONRPCCall: in = " + response.text); callback(response.json.result); } }, @@ -345,15 +345,24 @@ exports.makeJSONRPCCall = function makeJSONRPCCall(url, method, params, callback }; exports.initialize = function initialize(config, callback) { - var prefName = BTSPrefNS+"JSONURL"; - var urlStr = ""; + var prefJSONURLName = BTSPrefNS+"JSONURL"; + var prefDebugName = BTSPrefNS+"debug"; + var urlStr = "", + debugOption = false; // should we spit out a lot of debugging output - if (preferences.isSet(prefName)) { - urlStr = preferences.get(prefName); + if (preferences.isSet(prefJSONURLName)) { + urlStr = preferences.get(prefJSONURLName); } else { urlStr = JSONURLDefault; - preferences.set(prefName, JSONURLDefault); + preferences.set(prefJSONURLName, JSONURLDefault); + } + + if (preferences.isSet(prefDebugName)) { + debugOption = preferences.get(prefDebugName); + } + else { + preferences.set(prefDebugName, debugOption); } // Randomize URL to avoid caching @@ -388,6 +397,7 @@ exports.initialize = function initialize(config, callback) { } config.configData = {}; + config.configData.debuggingVerbose = debugOption; config.configData.matches = config.gJSONData.configData.matches; config.configData.skipMatches = config.configData.matches.map(function(x) { return x.replace("show_bug.cgi.*","((process|post)_bug|attachment)\.cgi$"); |