diff --git a/services/document-updater/app.coffee b/services/document-updater/app.coffee index 1d6a57239e..a1a18d5889 100644 --- a/services/document-updater/app.coffee +++ b/services/document-updater/app.coffee @@ -3,6 +3,8 @@ http = require("http") Settings = require('settings-sharelatex') logger = require('logger-sharelatex') logger.initialize("documentupdater") +logger.logger.serializers.docs = require("./app/js/LoggerSerializers").docs +logger.logger.serializers.files = require("./app/js/LoggerSerializers").files if Settings.sentry?.dsn? logger.initializeErrorReporting(Settings.sentry.dsn) diff --git a/services/document-updater/app/coffee/HttpController.coffee b/services/document-updater/app/coffee/HttpController.coffee index 4a7ff3b302..2f3f8d7d66 100644 --- a/services/document-updater/app/coffee/HttpController.coffee +++ b/services/document-updater/app/coffee/HttpController.coffee @@ -174,6 +174,8 @@ module.exports = HttpController = project_id = req.params.project_id {docs, files} = req.body + logger.log {project_id}, "queuing project history resync via http" HistoryManager.resyncProjectHistory project_id, docs, files, (error) -> return next(error) if error? + logger.log {project_id}, "queued project history resync via http" res.send 204 diff --git a/services/document-updater/app/coffee/LoggerSerializers.coffee b/services/document-updater/app/coffee/LoggerSerializers.coffee new file mode 100644 index 0000000000..3d4bfc42c2 --- /dev/null +++ b/services/document-updater/app/coffee/LoggerSerializers.coffee @@ -0,0 +1,14 @@ +module.exports = + docs: (docs) -> + docs.map (doc) -> + { + path: doc.path + id: doc.doc + } + + files: (files) -> + files.map (file) -> + { + path: file.path + id: file.file + } diff --git a/services/document-updater/app/coffee/RedisManager.coffee b/services/document-updater/app/coffee/RedisManager.coffee index 8f0b161bc0..a959b1dd41 100644 --- a/services/document-updater/app/coffee/RedisManager.coffee +++ b/services/document-updater/app/coffee/RedisManager.coffee @@ -322,6 +322,7 @@ module.exports = RedisManager = rclient.smembers keys.docsInProject(project_id: project_id), callback queueResyncProjectStructure: (project_id, docs, files, callback) -> + logger.log {project_id, docs, files}, "queue project structure resync" update = resyncProjectStructure: { docs, files } meta: @@ -330,6 +331,7 @@ module.exports = RedisManager = rclient.rpush projectHistoryKeys.projectHistoryOps({project_id}), jsonUpdate, callback queueResyncDocContents: (project_id, doc_id, lines, version, pathname, callback) -> + logger.log {project_id, doc_id, pathname}, "queue doc content resync" update = resyncDocContents: content: lines.join("\n"),