mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 06:34:39 -04:00
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:
parent
6462968e84
commit
b5fc6db75d
15 changed files with 56 additions and 71 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue