Make sending to Debug synchronous again

Fixes #1323

Being asynchronous meant the msg that was eventually sent to
Debug could be a modified version from later in the flow, if
the flow was other synchronous.
This commit is contained in:
Nick O'Leary 2017-07-04 23:30:51 +01:00
parent 0fd8d0e2bf
commit a10439b67c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 3 additions and 9 deletions

View File

@ -29,9 +29,7 @@ module.exports = function(RED) {
node.log("\n"+util.inspect(msg, {colors:useColors, depth:10}));
}
if (this.active) {
setTimeout(function() {
sendDebug({id:node.id,name:node.name,topic:msg.topic,msg:msg,_path:msg._path});
},0);
sendDebug({id:node.id,name:node.name,topic:msg.topic,msg:msg,_path:msg._path});
}
} else {
// debug user defined msg property
@ -55,9 +53,7 @@ module.exports = function(RED) {
}
}
if (this.active) {
setTimeout(function() {
sendDebug({id:node.id,z:node.z,name:node.name,topic:msg.topic,property:property,msg:output,_path:msg._path});
},0);
sendDebug({id:node.id,z:node.z,name:node.name,topic:msg.topic,property:property,msg:output,_path:msg._path});
}
}
});
@ -188,9 +184,7 @@ 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) {
setTimeout(function() {
sendDebug(msg);
},0);
sendDebug(msg);
}
});
RED.log.addHandler(DebugNode.logHandler);