Database logging cancels persistent debug log storage

Database logging is helpful as a debugging tool, but it creates an
infinite loop with the debug log, which wants to write to the database,
which wants to write to the log, which wants to write to the database,
which wants to write to the log, which wants to write to the database,
which wants to write to the log, which wants to write to the database...

// FREEBIE
This commit is contained in:
lilia 2017-04-07 22:53:18 -07:00 committed by Scott Nonnenberg
parent 550b926a15
commit 34042415e9
No known key found for this signature in database
GPG key ID: A4931C09644C654B

View file

@ -28,7 +28,11 @@
this.fetch({remove: false}); this.fetch({remove: false});
}, },
log: function(str) { log: function(str) {
this.add({time: Date.now(), value: str}).save(); var entry = this.add({time: Date.now(), value: str});
if (window.Whisper.Database.nolog) {
entry.save();
}
while (this.length > MAX_MESSAGES) { while (this.length > MAX_MESSAGES) {
this.at(0).destroy(); this.at(0).destroy();
} }