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

Merge pull request #3300 from node-red/remove-use-of-verbose-flag-in-core-nodes

Remove use of verbose flag in core nodes - and use node.debug level instead
This commit is contained in:
Nick O'Leary 2022-01-12 17:38:34 +00:00 committed by GitHub
commit c6a38b8355
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 14 deletions

View File

@ -75,16 +75,12 @@ module.exports = function(RED) {
node.repeaterSetup = function () { node.repeaterSetup = function () {
if (this.repeat && !isNaN(this.repeat) && this.repeat > 0) { if (this.repeat && !isNaN(this.repeat) && this.repeat > 0) {
this.repeat = this.repeat * 1000; this.repeat = this.repeat * 1000;
if (RED.settings.verbose) { this.debug(RED._("inject.repeat", this));
this.log(RED._("inject.repeat", this));
}
this.interval_id = setInterval(function() { this.interval_id = setInterval(function() {
node.emit("input", {}); node.emit("input", {});
}, this.repeat); }, this.repeat);
} else if (this.crontab) { } else if (this.crontab) {
if (RED.settings.verbose) { this.debug(RED._("inject.crontab", this));
this.log(RED._("inject.crontab", this));
}
this.cronjob = scheduleTask(this.crontab,() => { node.emit("input", {})}); this.cronjob = scheduleTask(this.crontab,() => { node.emit("input", {})});
} }
}; };
@ -148,10 +144,8 @@ module.exports = function(RED) {
} }
if (this.interval_id != null) { if (this.interval_id != null) {
clearInterval(this.interval_id); clearInterval(this.interval_id);
if (RED.settings.verbose) { this.log(RED._("inject.stopped")); }
} else if (this.cronjob != null) { } else if (this.cronjob != null) {
this.cronjob.stop(); this.cronjob.stop();
if (RED.settings.verbose) { this.log(RED._("inject.stopped")); }
delete this.cronjob; delete this.cronjob;
} }
}; };

View File

@ -86,7 +86,7 @@ module.exports = function(RED) {
}); });
var cmd = arg.shift(); var cmd = arg.shift();
/* istanbul ignore else */ /* istanbul ignore else */
if (RED.settings.verbose) { node.log(cmd+" ["+arg+"]"); } node.debug(cmd+" ["+arg+"]");
child = spawn(cmd,arg,node.spawnOpt); child = spawn(cmd,arg,node.spawnOpt);
node.status({fill:"blue",shape:"dot",text:"pid:"+child.pid}); node.status({fill:"blue",shape:"dot",text:"pid:"+child.pid});
var unknownCommand = (child.pid === undefined); var unknownCommand = (child.pid === undefined);
@ -136,7 +136,7 @@ module.exports = function(RED) {
} }
else { else {
/* istanbul ignore else */ /* istanbul ignore else */
if (RED.settings.verbose) { node.log(arg); } node.debug(arg);
child = exec(arg, node.execOpt, function (error, stdout, stderr) { child = exec(arg, node.execOpt, function (error, stdout, stderr) {
var msg2, msg3; var msg2, msg3;
delete msg.payload; delete msg.payload;
@ -155,7 +155,7 @@ module.exports = function(RED) {
if (error.signal) { msg3.payload.signal = error.signal; } if (error.signal) { msg3.payload.signal = error.signal; }
if (error.code === null) { node.status({fill:"red",shape:"dot",text:"killed"}); } if (error.code === null) { node.status({fill:"red",shape:"dot",text:"killed"}); }
else { node.status({fill:"red",shape:"dot",text:"error:"+error.code}); } else { node.status({fill:"red",shape:"dot",text:"error:"+error.code}); }
if (RED.settings.verbose) { node.log('error:' + error); } node.debug('error:' + error);
} }
else if (node.oldrc === "false") { else if (node.oldrc === "false") {
msg3 = RED.util.cloneMessage(msg); msg3 = RED.util.cloneMessage(msg);

View File

@ -71,9 +71,7 @@ module.exports = function(RED) {
node.error(RED._("file.errors.deletefail",{error:err.toString()}),msg); node.error(RED._("file.errors.deletefail",{error:err.toString()}),msg);
} }
else { else {
if (RED.settings.verbose) { node.debug(RED._("file.status.deletedfile",{file:filename}));
node.log(RED._("file.status.deletedfile",{file:filename}));
}
nodeSend(msg); nodeSend(msg);
} }
done(); done();