Merge pull request #1894 from strongloop/feature/improve-replication-debugging

PersistedModel: log rectify/rectifyAll triggers
This commit is contained in:
Miroslav Bajtoš 2015-12-17 15:51:29 +01:00
commit b2c9c97c2c
1 changed files with 13 additions and 0 deletions

View File

@ -1442,6 +1442,13 @@ module.exports = function(registry) {
var id = instance ? instance.getId() :
getIdFromWhereByModelId(ctx.Model, ctx.where);
if (debug.enabled) {
debug('rectifyOnSave %s -> ' + (id ? 'id %j' : '%s'),
ctx.Model.modelName, id ? id : 'ALL');
debug('context instance:%j currentInstance:%j where:%j data %j',
ctx.instance, ctx.currentInstance, ctx.where, ctx.data);
}
if (id) {
ctx.Model.rectifyChange(id, reportErrorAndNext);
} else {
@ -1460,6 +1467,12 @@ module.exports = function(registry) {
var id = ctx.instance ? ctx.instance.getId() :
getIdFromWhereByModelId(ctx.Model, ctx.where);
if (debug.enabled) {
debug('rectifyOnDelete %s -> ' + (id ? 'id %j' : '%s'),
ctx.Model.modelName, id ? id : 'ALL');
debug('context instance:%j where:%j', ctx.instance, ctx.where);
}
if (id) {
ctx.Model.rectifyChange(id, reportErrorAndNext);
} else {