Change debug.store.submitLimit to debug.store.submitSize and have it be the number of characters in the output, defaulting to 1 million

This commit is contained in:
Dan Stillman 2011-09-02 05:17:30 +00:00
parent 15bab1db24
commit 5d92a9c43d
3 changed files with 22 additions and 10 deletions

View file

@ -1335,7 +1335,7 @@ Zotero_Preferences.Debug_Output = {
var url = "https://repo.zotero.org/repo/report?debug=1"; var url = "https://repo.zotero.org/repo/report?debug=1";
var output = Zotero.Debug.get( var output = Zotero.Debug.get(
Zotero.Prefs.get('debug.store.submitLimit'), Zotero.Prefs.get('debug.store.submitSize'),
Zotero.Prefs.get('debug.store.submitLineLength') Zotero.Prefs.get('debug.store.submitLineLength')
); );
Zotero_Preferences.Debug_Output.setStore(false); Zotero_Preferences.Debug_Output.setStore(false);

View file

@ -107,24 +107,36 @@ Zotero.Debug = new function () {
} }
this.get = function (limit, maxLength) { this.get = function (maxChars, maxLineLength) {
var output = _output; var output = _output;
var total = output.length; var total = output.length;
if (limit && limit < total) { if (total == 0) {
output = output.slice(limit * -1); return "";
} }
if (maxLength) { if (maxLineLength) {
for (var i=0, len=output.length; i<len; i++) { for (var i=0, len=output.length; i<len; i++) {
var origLength = output[i].length; if (output[i].length > maxLineLength) {
if (origLength > maxLength) { output[i] = Zotero.Utilities.ellipsize(output[i], maxLineLength, true);
output[i] = Zotero.Utilities.ellipsize(output[i], maxLength, true);
} }
} }
} }
return output.join('\n\n'); output = output.join('\n\n');
if (maxChars) {
output = output.substr(maxChars * -1);
// Cut at two newlines
for (var i=1, len=output.length; i<len; i++) {
if (output[i] == '\n' && output[i-1] == '\n') {
output = output.substr(i + 1);
break;
}
}
}
return output;
} }

View file

@ -14,7 +14,7 @@ pref("extensions.zotero.debug.log",false);
pref("extensions.zotero.debug.stackTrace", false); pref("extensions.zotero.debug.stackTrace", false);
pref("extensions.zotero.debug.store",false); pref("extensions.zotero.debug.store",false);
pref("extensions.zotero.debug.store.limit",500000); pref("extensions.zotero.debug.store.limit",500000);
pref("extensions.zotero.debug.store.submitLimit",100000); pref("extensions.zotero.debug.store.submitSize",1000000);
pref("extensions.zotero.debug.store.submitLineLength",10000); pref("extensions.zotero.debug.store.submitLineLength",10000);
pref("extensions.zotero.debug.level",5); pref("extensions.zotero.debug.level",5);
pref("extensions.zotero.debug.time", false); pref("extensions.zotero.debug.time", false);