diff options
author | Sheogorath | 2019-06-08 20:51:24 +0200 |
---|---|---|
committer | Sheogorath | 2019-06-08 21:27:29 +0200 |
commit | b5fc6db75db61d9765da38e0f085dd737380f9f4 (patch) | |
tree | d221b850be9f961f357b7592636cd35868675383 /lib/history.js | |
parent | 6462968e84e8d92292dd23764a9e558d7800147d (diff) |
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 <sheogorath@shivering-isles.com>
Diffstat (limited to '')
-rw-r--r-- | lib/history.js | 7 |
1 files changed, 2 insertions, 5 deletions
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) { |