mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
add logging of raw updates
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
Settings = require "settings-sharelatex"
|
||||
logger = require "logger-sharelatex"
|
||||
logger.initialize("track-changes")
|
||||
TrackChangesLogger = logger.initialize("track-changes").logger
|
||||
|
||||
if Settings.sentry?.dsn?
|
||||
logger.initializeErrorReporting(Settings.sentry.dsn)
|
||||
|
||||
# log updates as truncated strings
|
||||
truncateFn = (updates) ->
|
||||
JSON.stringify updates, (key, value) ->
|
||||
if typeof value == 'string' && (len = value.length) > 80
|
||||
return value.substr(0,32) + "...(message of length #{len} truncated)..." + value.substr(-32)
|
||||
else
|
||||
return value
|
||||
|
||||
TrackChangesLogger.addSerializers {
|
||||
rawUpdates: truncateFn
|
||||
newUpdates: truncateFn
|
||||
lastUpdate: truncateFn
|
||||
}
|
||||
|
||||
Path = require "path"
|
||||
Metrics = require "metrics-sharelatex"
|
||||
Metrics.initialize("track-changes")
|
||||
|
||||
@@ -102,6 +102,7 @@ module.exports = UpdatesManager =
|
||||
# parse the redis strings into ShareJs updates
|
||||
RedisManager.expandDocUpdates docUpdates, (error, rawUpdates) ->
|
||||
return callback(error) if error?
|
||||
logger.log project_id: project_id, doc_id: doc_id, rawUpdates: rawUpdates, "retrieved raw updates from redis"
|
||||
UpdatesManager.compressAndSaveRawUpdates project_id, doc_id, rawUpdates, temporary, (error) ->
|
||||
return callback(error) if error?
|
||||
logger.log project_id: project_id, doc_id: doc_id, "compressed and saved doc updates"
|
||||
|
||||
Reference in New Issue
Block a user