mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
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:
parent
0fd8d0e2bf
commit
a10439b67c
@ -29,9 +29,7 @@ module.exports = function(RED) {
|
|||||||
node.log("\n"+util.inspect(msg, {colors:useColors, depth:10}));
|
node.log("\n"+util.inspect(msg, {colors:useColors, depth:10}));
|
||||||
}
|
}
|
||||||
if (this.active) {
|
if (this.active) {
|
||||||
setTimeout(function() {
|
sendDebug({id:node.id,name:node.name,topic:msg.topic,msg:msg,_path:msg._path});
|
||||||
sendDebug({id:node.id,name:node.name,topic:msg.topic,msg:msg,_path:msg._path});
|
|
||||||
},0);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// debug user defined msg property
|
// debug user defined msg property
|
||||||
@ -55,9 +53,7 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.active) {
|
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});
|
||||||
sendDebug({id:node.id,z:node.z,name:node.name,topic:msg.topic,property:property,msg:output,_path:msg._path});
|
|
||||||
},0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -188,9 +184,7 @@ module.exports = function(RED) {
|
|||||||
DebugNode.logHandler = new events.EventEmitter();
|
DebugNode.logHandler = new events.EventEmitter();
|
||||||
DebugNode.logHandler.on("log",function(msg) {
|
DebugNode.logHandler.on("log",function(msg) {
|
||||||
if (msg.level === RED.log.WARN || msg.level === RED.log.ERROR) {
|
if (msg.level === RED.log.WARN || msg.level === RED.log.ERROR) {
|
||||||
setTimeout(function() {
|
sendDebug(msg);
|
||||||
sendDebug(msg);
|
|
||||||
},0);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RED.log.addHandler(DebugNode.logHandler);
|
RED.log.addHandler(DebugNode.logHandler);
|
||||||
|
Loading…
Reference in New Issue
Block a user