mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
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:
@@ -57,7 +57,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
|
||||
tail.stderr.on("data", function(data) {
|
||||
node.warn(data.toString());
|
||||
node.error(data.toString());
|
||||
});
|
||||
|
||||
this.on("close", function() {
|
||||
|
@@ -40,7 +40,7 @@ module.exports = function(RED) {
|
||||
} else if (msg.hasOwnProperty('delete')) {
|
||||
node.warn("Deprecated: please use specific delete option in config dialog.");
|
||||
fs.unlink(filename, function (err) {
|
||||
if (err) { node.warn('Failed to delete file : '+err); }
|
||||
if (err) { node.error('Failed to delete file : '+err); }
|
||||
});
|
||||
} else if (typeof msg.payload != "undefined") {
|
||||
var data = msg.payload;
|
||||
@@ -53,13 +53,13 @@ module.exports = function(RED) {
|
||||
// using "binary" not {encoding:"binary"} to be 0.8 compatible for a while
|
||||
//fs.writeFile(filename, data, {encoding:"binary"}, function (err) {
|
||||
fs.writeFile(filename, data, "binary", function (err) {
|
||||
if (err) { node.warn('Failed to write to file : '+err); }
|
||||
if (err) { node.error('Failed to write to file : '+err); }
|
||||
else if (RED.settings.verbose) { node.log('wrote to file: '+filename); }
|
||||
});
|
||||
}
|
||||
else if (this.overwriteFile === "delete") {
|
||||
fs.unlink(filename, function (err) {
|
||||
if (err) { node.warn('Failed to delete file : '+err); }
|
||||
if (err) { node.error('Failed to delete file : '+err); }
|
||||
else if (RED.settings.verbose) { node.log("deleted file: "+filename); }
|
||||
});
|
||||
}
|
||||
@@ -67,7 +67,7 @@ module.exports = function(RED) {
|
||||
// using "binary" not {encoding:"binary"} to be 0.8 compatible for a while longer
|
||||
//fs.appendFile(filename, data, {encoding:"binary"}, function (err) {
|
||||
fs.appendFile(filename, data, "binary", function (err) {
|
||||
if (err) { node.warn('Failed to append to file : '+err); }
|
||||
if (err) { node.error('Failed to append to file : '+err); }
|
||||
else if (RED.settings.verbose) { node.log('appended to file: '+filename); }
|
||||
});
|
||||
}
|
||||
@@ -103,7 +103,7 @@ module.exports = function(RED) {
|
||||
msg.filename = filename;
|
||||
fs.readFile(filename,options,function(err,data) {
|
||||
if (err) {
|
||||
node.warn(err);
|
||||
node.error(err);
|
||||
msg.error = err;
|
||||
delete msg.payload;
|
||||
} else {
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
module.exports = function(RED) {
|
||||
"use strict";
|
||||
var util = require("util");
|
||||
var redis = require("redis");
|
||||
|
||||
var hashFieldRE = /^([^=]+)=(.*)$/;
|
||||
@@ -29,10 +28,10 @@ module.exports = function(RED) {
|
||||
if (!connections[id]) {
|
||||
connections[id] = redis.createClient(port,host);
|
||||
connections[id].on("error",function(err) {
|
||||
util.log("[redis] "+err);
|
||||
RED.log.error(err);
|
||||
});
|
||||
connections[id].on("connect",function() {
|
||||
util.log("[redis] connected to "+host+":"+port);
|
||||
if (RED.settings.verbose) { RED.log.info("connected to "+host+":"+port); }
|
||||
});
|
||||
connections[id]._id = id;
|
||||
connections[id]._nodeCount = 0;
|
||||
|
Reference in New Issue
Block a user