From 34042415e98911e2e4f40c41e8bbed184e71ed81 Mon Sep 17 00:00:00 2001 From: lilia Date: Fri, 7 Apr 2017 22:53:18 -0700 Subject: [PATCH] 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 --- js/debugLog.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/debugLog.js b/js/debugLog.js index 8c91b74e03..d1409e7795 100644 --- a/js/debugLog.js +++ b/js/debugLog.js @@ -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(); }