mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-21 03:03:40 +00:00
add logging of raw updates
This commit is contained in:
parent
29c7c5e249
commit
b3ddd839e6
2 changed files with 16 additions and 1 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue