1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Add serialport config node id to debug log for info

This commit is contained in:
Dave Conway-Jones 2021-06-07 10:31:42 +01:00
parent bb6491942e
commit f35e4baaef
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
2 changed files with 6 additions and 6 deletions

View File

@ -347,7 +347,7 @@ module.exports = function(RED) {
if (err) {
if (err.toString() !== olderr) {
olderr = err.toString();
RED.log.error(RED._("serial.errors.error",{port:port,error:olderr}), {});
RED.log.error("[serialconfig:"+serialConfig.id+"] "+RED._("serial.errors.error",{port:port,error:olderr}), {});
}
obj.tout = setTimeout(function() {
setupSerial();
@ -355,7 +355,7 @@ module.exports = function(RED) {
}
});
obj.serial.on('error', function(err) {
RED.log.error(RED._("serial.errors.error",{port:port,error:err.toString()}), {});
RED.log.error("[serialconfig:"+serialConfig.id+"] "+RED._("serial.errors.error",{port:port,error:err.toString()}), {});
obj._emitter.emit('closed');
if (obj.tout) { clearTimeout(obj.tout); }
obj.tout = setTimeout(function() {
@ -366,7 +366,7 @@ module.exports = function(RED) {
if (!obj._closing) {
if (olderr !== "unexpected") {
olderr = "unexpected";
RED.log.error(RED._("serial.errors.unexpected-close",{port:port}), {});
RED.log.error("[serialconfig:"+serialConfig.id+"] "+RED._("serial.errors.unexpected-close",{port:port}), {});
}
obj._emitter.emit('closed');
if (obj.tout) { clearTimeout(obj.tout); }
@ -377,7 +377,7 @@ module.exports = function(RED) {
});
obj.serial.on('open',function() {
olderr = "";
RED.log.info(RED._("serial.onopen",{port:port,baud:baud,config: databits+""+parity.charAt(0).toUpperCase()+stopbits}));
RED.log.info("[serialconfig:"+serialConfig.id+"] "+RED._("serial.onopen",{port:port,baud:baud,config: databits+""+parity.charAt(0).toUpperCase()+stopbits}));
// Set flow control pins if necessary. Must be set all in same command.
var flags = {};
if (dtr != "none") { flags.dtr = (dtr!="low"); }

View File

@ -1,9 +1,9 @@
{
"name" : "node-red-node-serialport",
"version" : "0.14.0",
"version" : "0.14.1",
"description" : "Node-RED nodes to talk to serial ports",
"dependencies" : {
"serialport" : "^9.0.7"
"serialport" : "^9.1.0"
},
"repository" : {
"type":"git",