From 3b1cc39f2108c551f50b5d28c70259e5d14163b0 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 30 Aug 2011 23:10:23 +0000 Subject: [PATCH] Add debug.store.submitLimit and debug.store.submitLineLength prefs to limit number and length of debug output lines submitted --- .../content/zotero/preferences/preferences.js | 7 +++++-- chrome/content/zotero/xpcom/debug.js | 21 +++++++++++++++++-- defaults/preferences/zotero.js | 4 +++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js index ce9d8f7679..cccc0864f5 100644 --- a/chrome/content/zotero/preferences/preferences.js +++ b/chrome/content/zotero/preferences/preferences.js @@ -1333,8 +1333,11 @@ Zotero_Preferences.Debug_Output = { document.getElementById('debug-output-submit').disabled = true; document.getElementById('debug-output-submit-progress').hidden = false; - var url = "http://www.zotero.org/repo/report?debug=1"; - var output = Zotero.Debug.get(); + var url = "https://repo.zotero.org/repo/report?debug=1"; + var output = Zotero.Debug.get( + Zotero.Prefs.get('debug.store.submitLimit'), + Zotero.Prefs.get('debug.store.submitLineLength') + ); Zotero_Preferences.Debug_Output.setStore(false); var uploadCallback = function (xmlhttp) { diff --git a/chrome/content/zotero/xpcom/debug.js b/chrome/content/zotero/xpcom/debug.js index c5c32ebb5e..7074117985 100644 --- a/chrome/content/zotero/xpcom/debug.js +++ b/chrome/content/zotero/xpcom/debug.js @@ -106,8 +106,25 @@ Zotero.Debug = new function () { } } - this.get = function () { - return _output.join('\n\n'); + + this.get = function (limit, maxLength) { + var output = _output; + var total = output.length; + + if (limit && limit < total) { + output = output.slice(limit * -1); + } + + if (maxLength) { + for (var i=0, len=output.length; i maxLength) { + output[i] = Zotero.Utilities.ellipsize(output[i], maxLength, true); + } + } + } + + return output.join('\n\n'); } diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js index b798647a7a..1c9d2732f7 100644 --- a/defaults/preferences/zotero.js +++ b/defaults/preferences/zotero.js @@ -13,7 +13,9 @@ pref("extensions.zotero.dbLockExclusive", true); pref("extensions.zotero.debug.log",false); pref("extensions.zotero.debug.stackTrace", false); pref("extensions.zotero.debug.store",false); -pref("extensions.zotero.debug.store.limit",750000); +pref("extensions.zotero.debug.store.limit",500000); +pref("extensions.zotero.debug.store.submitLimit",100000); +pref("extensions.zotero.debug.store.submitLineLength",10000); pref("extensions.zotero.debug.level",5); pref("extensions.zotero.debug.time", false); pref("extensions.zotero.automaticScraperUpdates",true);