PersistedModel: log rectify/rectifyAll triggers

Add debug logging to identify what operations trigger rectify and
rectifyAll calls.
This commit is contained in:
Miroslav Bajtoš 2015-12-17 14:13:47 +01:00
parent 3b66fc1c88
commit 5e4bf1dd25
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 {