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/history.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/history.js') diff --git a/lib/history.js b/lib/history.js index 9c389bfa..88a7ee05 100644 --- a/lib/history.js +++ b/lib/history.js @@ -4,7 +4,6 @@ var LZString = require('lz-string') // core -var config = require('./config') var logger = require('./logger') var response = require('./response') var models = require('./models') @@ -56,9 +55,7 @@ function getHistory (userid, callback) { } history = parseHistoryToObject(history) } - if (config.debug) { - logger.info('read history success: ' + user.id) - } + logger.debug(`read history success: ${user.id}`) return callback(null, history) }).catch(function (err) { logger.error('read history failed: ' + err) @@ -140,7 +137,7 @@ function historyPost (req, res) { var noteId = req.params.noteId if (!noteId) { if (typeof req.body['history'] === 'undefined') return response.errorBadRequest(res) - if (config.debug) { logger.info('SERVER received history from [' + req.user.id + ']: ' + req.body.history) } + logger.debug(`SERVER received history from [${req.user.id}]: ${req.body.history}`) try { var history = JSON.parse(req.body.history) } catch (err) { -- cgit v1.2.3