Add maxDepth as the third argument to Zotero.debug()

varDump(), which is used by Zotero.debug(), defaults to 5
This commit is contained in:
Dan Stillman 2017-01-17 02:31:10 -05:00
parent a017fe6666
commit 786f5efa30
2 changed files with 5 additions and 4 deletions

View File

@ -82,13 +82,13 @@ Zotero.Debug = new function () {
} }
} }
this.log = function (message, level, stack) { this.log = function (message, level, maxDepth, stack) {
if (!this.enabled) { if (!this.enabled) {
return; return;
} }
if (typeof message != 'string') { if (typeof message != 'string') {
message = Zotero.Utilities.varDump(message); message = Zotero.Utilities.varDump(message, 0, maxDepth);
} }
if (!level) { if (!level) {

View File

@ -1031,11 +1031,12 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
* *
* @param {} message * @param {} message
* @param {Integer} [level=3] * @param {Integer} [level=3]
* @param {Integer} [maxDepth]
* @param {Boolean|Integer} [stack] Whether to display the calling stack. * @param {Boolean|Integer} [stack] Whether to display the calling stack.
* If true, stack is displayed starting from the caller. If an integer, * If true, stack is displayed starting from the caller. If an integer,
* that many stack levels will be omitted starting from the caller. * that many stack levels will be omitted starting from the caller.
*/ */
function debug(message, level, stack) { function debug(message, level, maxDepth, stack) {
// Account for this alias // Account for this alias
if (stack === true) { if (stack === true) {
stack = 1; stack = 1;
@ -1043,7 +1044,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
stack++; stack++;
} }
Zotero.Debug.log(message, level, stack); Zotero.Debug.log(message, level, maxDepth, stack);
} }