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>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user