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

View File

@@ -28,7 +28,11 @@
this.fetch({remove: false});
},
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) {
this.at(0).destroy();
}