From b5fc6db75db61d9765da38e0f085dd737380f9f4 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Sat, 8 Jun 2019 20:51:24 +0200 Subject: Rework debug logging We have various places with overly simple if statements that could be handled by our logging library. Also a lot of those logs are not marked as debug logs but as info logs, which can cause confusion during debugging. This patch removed unneeded if clauses around debug logging statements, reworks debug log messages towards ECMA templates and add some new logging statements which might be helpful in order to debug things like image uploads. Signed-off-by: Sheogorath --- lib/workers/dmpWorker.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'lib/workers') diff --git a/lib/workers/dmpWorker.js b/lib/workers/dmpWorker.js index 60db0a12..ca68b4ab 100644 --- a/lib/workers/dmpWorker.js +++ b/lib/workers/dmpWorker.js @@ -4,7 +4,6 @@ var DiffMatchPatch = require('diff-match-patch') var dmp = new DiffMatchPatch() // core -var config = require('../config') var logger = require('../logger') process.on('message', function (data) { @@ -61,10 +60,8 @@ function createPatch (lastDoc, currDoc) { var patch = dmp.patch_make(lastDoc, diff) patch = dmp.patch_toText(patch) var msEnd = (new Date()).getTime() - if (config.debug) { - logger.info(patch) - logger.info((msEnd - msStart) + 'ms') - } + logger.debug(patch) + logger.debug((msEnd - msStart) + 'ms') return patch } @@ -123,9 +120,7 @@ function getRevision (revisions, count) { authorship: authorship } var msEnd = (new Date()).getTime() - if (config.debug) { - logger.info((msEnd - msStart) + 'ms') - } + logger.debug((msEnd - msStart) + 'ms') return data } -- cgit v1.2.3