Remove most of the console.logs

This commit is contained in:
Ben Hardill 2021-04-08 12:02:29 +01:00
parent d7df13bc2b
commit a84fddc8f0
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7
2 changed files with 27 additions and 18 deletions

View File

@ -229,12 +229,21 @@ module.exports = function(RED) {
node.status({fill: 'green',shape: 'dot',text: 'found'}); node.status({fill: 'green',shape: 'dot',text: 'found'});
} }
node.on('input', function(msg) { node.on('input', function(msg, send, done){
var dev = wemo.get(node.dev); var dev = wemo.get(node.dev);
send = send || function() { node.send.apply(node,arguments) }
if (!dev) { if (!dev) {
//need to show that dev not currently found //need to show that dev not currently found
console.log('no device found'); // console.log('no device found');
if (done) {
done("Device not discovered yet")
} else {
node.error("Device not discovered yet", msg)
}
return; return;
} }

View File

@ -273,7 +273,7 @@ WeMoNG.prototype.start = function start() {
post_request.on('error', function(err){ post_request.on('error', function(err){
// should log err // should log err
console.log(err); //console.log(err);
}) })
post_request.write(util.format(getenddevs.body, udn)); post_request.write(util.format(getenddevs.body, udn));
@ -363,12 +363,12 @@ WeMoNG.prototype.toggleSocket = function toggleSocket(socket, on) {
}); });
post_request.on('error', function (e) { post_request.on('error', function (e) {
console.log(e); // console.log(e);
console.log("%j", postoptions); // console.log("%j", postoptions);
}); });
post_request.on('timeout', function () { post_request.on('timeout', function () {
console.log("Timeout"); // console.log("Timeout");
post_request.abort(); post_request.abort();
}); });
@ -420,8 +420,8 @@ WeMoNG.prototype.getSocketStatus = function getSocketStatus(socket) {
}); });
post_request.on('error', function (e) { post_request.on('error', function (e) {
console.log(e); // console.log(e);
console.log("%j", postoptions); // console.log("%j", postoptions);
def.reject(e); def.reject(e);
}); });
@ -471,8 +471,8 @@ WeMoNG.prototype.getInsightParams = function getInsightParams(socket) {
}); });
post_request.on('error', function (e) { post_request.on('error', function (e) {
console.log(e); // console.log(e);
console.log("%j", postoptions); // console.log("%j", postoptions);
def.reject(e); def.reject(e);
}); });
@ -527,12 +527,12 @@ WeMoNG.prototype.getLightStatus = function getLightStatus(light) {
def.resolve(obj); def.resolve(obj);
} else { } else {
def.reject(err); def.reject(err);
console.log("err"); // console.log("err");
} }
}); });
} }
} else { } else {
console.log("err"); // console.log("err");
def.reject(err); def.reject(err);
} }
}); });
@ -540,13 +540,13 @@ WeMoNG.prototype.getLightStatus = function getLightStatus(light) {
}); });
post_request.on('error', function (e) { post_request.on('error', function (e) {
console.log(e); // console.log(e);
console.log("%j", postoptions); // console.log("%j", postoptions);
def.reject(e); def.reject(e);
}); });
post_request.on('timeout', function () { post_request.on('timeout', function () {
console.log("Timeout"); // console.log("Timeout");
post_request.abort("timeout"); post_request.abort("timeout");
def.reject(); def.reject();
}); });
@ -583,12 +583,12 @@ WeMoNG.prototype.setStatus = function setStatus(light, capability, value) {
}); });
post_request.on('error', function (e) { post_request.on('error', function (e) {
console.log(e); // console.log(e);
console.log("%j", postoptions); // console.log("%j", postoptions);
}); });
post_request.on('timeout', function () { post_request.on('timeout', function () {
console.log("Timeout"); // console.log("Timeout");
post_request.abort(); post_request.abort();
}); });