Move transaction wait debug output to level 6, and strip Bluebird lines

This output is basically only useful when something hangs, so it can
stay off all other times.

For now, 6 can be the new only-use-when-something-is-actively-broken
level. At some point we may want to move DB activity to 4 and make this
sort of thing 5, because we don't have much that's 4 right now.
This commit is contained in:
Dan Stillman 2015-06-08 03:59:16 -04:00
parent 2d6143dce1
commit 9a45fa94bd
2 changed files with 14 additions and 2 deletions

View file

@ -584,8 +584,10 @@ Zotero.DBConnection.prototype.waitForTransaction = function () {
if (!this._inTransaction) {
return Zotero.Promise.resolve().cancellable();
}
Zotero.debug("Waiting for transaction to finish");
Zotero.debug((new Error).stack);
if (Zotero.Debug.enabled) {
Zotero.debug("Waiting for transaction to finish", 5);
Zotero.debug(Zotero.Debug.filterStack((new Error).stack), 6);
}
return this._transactionPromise;
};

View file

@ -204,4 +204,14 @@ Zotero.Debug = new function () {
}
return str.substr(1);
};
/**
* Strip Bluebird lines from a stack trace
*
* @param {String} stack
*/
this.filterStack = function (stack) {
return stack.split(/\n/).filter(line => line.indexOf('zotero/bluebird') == -1).join('\n');
}
}