From 5e4bf1dd251d61dacf2fbb14aeb4fd1960bce454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 17 Dec 2015 14:13:47 +0100 Subject: [PATCH] PersistedModel: log rectify/rectifyAll triggers Add debug logging to identify what operations trigger rectify and rectifyAll calls. --- lib/persisted-model.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/persisted-model.js b/lib/persisted-model.js index 4605caa2..7862916d 100644 --- a/lib/persisted-model.js +++ b/lib/persisted-model.js @@ -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 {