Add debug.store.submitLimit and debug.store.submitLineLength prefs to limit number and length of debug output lines submitted

This commit is contained in:
Dan Stillman 2011-08-30 23:10:23 +00:00
parent 87a5846155
commit 3b1cc39f21
3 changed files with 27 additions and 5 deletions

View file

@ -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) {

View file

@ -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<len; i++) {
var origLength = output[i].length;
if (origLength > maxLength) {
output[i] = Zotero.Utilities.ellipsize(output[i], maxLength, true);
}
}
}
return output.join('\n\n');
}

View file

@ -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);