diff --git a/nodes/core/core/58-debug.js b/nodes/core/core/58-debug.js index 797f44ac0..1cb313ad5 100644 --- a/nodes/core/core/58-debug.js +++ b/nodes/core/core/58-debug.js @@ -29,7 +29,9 @@ module.exports = function(RED) { node.log("\n"+util.inspect(msg, {colors:useColors, depth:10})); } if (this.active) { - sendDebug({id:this.id,name:this.name,topic:msg.topic,msg:msg,_path:msg._path}); + setTimeout(function() { + sendDebug({id:node.id,name:node.name,topic:msg.topic,msg:msg,_path:msg._path}); + },0); } } else { // debug user defined msg property @@ -53,7 +55,9 @@ module.exports = function(RED) { } } if (this.active) { - sendDebug({id:this.id,z:this.z,name:this.name,topic:msg.topic,property:property,msg:output,_path:msg._path}); + setTimeout(function() { + sendDebug({id:node.id,z:node.z,name:node.name,topic:msg.topic,property:property,msg:output,_path:msg._path}); + },0); } } }); @@ -178,7 +182,9 @@ module.exports = function(RED) { DebugNode.logHandler = new events.EventEmitter(); DebugNode.logHandler.on("log",function(msg) { if (msg.level === RED.log.WARN || msg.level === RED.log.ERROR) { - sendDebug(msg); + setTimeout(function() { + sendDebug(msg); + },0); } }); RED.log.addHandler(DebugNode.logHandler);