Tidy up all console.log util.log from core nodes.

Try to make log,warn,error more consistent behaviour.

Especially make sure any existing catches produce errors
This commit is contained in:
dceejay
2015-02-25 19:10:44 +00:00
parent b6245bdef7
commit 71ff828947
13 changed files with 54 additions and 65 deletions

View File

@@ -32,13 +32,13 @@ module.exports = function(RED) {
if (this.repeat && !isNaN(this.repeat) && this.repeat > 0) {
this.repeat = this.repeat * 1000;
this.log("repeat = "+this.repeat);
if (RED.settings.verbose) { this.log("repeat = "+this.repeat); }
this.interval_id = setInterval( function() {
node.emit("input",{});
}, this.repeat );
} else if (this.crontab) {
if (cron) {
this.log("crontab = "+this.crontab);
if (RED.settings.verbose) { this.log("crontab = "+this.crontab); }
this.cronjob = new cron.CronJob(this.crontab,
function() {
node.emit("input",{});
@@ -72,14 +72,14 @@ module.exports = function(RED) {
InjectNode.prototype.close = function() {
if (this.interval_id != null) {
clearInterval(this.interval_id);
this.log("inject: repeat stopped");
if (RED.settings.verbose) { this.log("inject: repeat stopped"); }
} else if (this.cronjob != null) {
this.cronjob.stop();
this.log("inject: cronjob stopped");
if (RED.settings.verbose) { this.log("inject: cronjob stopped"); }
delete this.cronjob;
}
}
RED.httpAdmin.post("/inject/:id", RED.auth.needsPermission("inject.write"), function(req,res) {
var node = RED.nodes.getNode(req.params.id);
if (node != null) {
@@ -89,7 +89,6 @@ module.exports = function(RED) {
} catch(err) {
res.send(500);
node.error("Inject failed:"+err);
console.log(err.stack);
}
} else {
res.send(404);

View File

@@ -58,7 +58,7 @@ module.exports = function(RED) {
node.send([null,null,msg]);
});
ex.on('error', function (code) {
node.warn(code);
node.error(code);
});
}
else { node.error("Spawn command must be just the command - no spaces or extra parameters"); }

View File

@@ -147,7 +147,6 @@ module.exports = function(RED) {
node.send(node.buffer.shift()); // send the first on the queue
}
node.status({text:node.buffer.length});
//console.log(node.buffer);
},node.rate);
this.on("input", function(msg) {