Add back debug logging for device/connection start
This commit is contained in:
parent
5811cf2518
commit
29583c0bd5
38
lib/robot.js
38
lib/robot.js
|
@ -333,15 +333,25 @@ Robot.prototype.startWork = function() {
|
|||
//
|
||||
// Returns nothing
|
||||
Robot.prototype.startConnections = function(callback) {
|
||||
var starters = {};
|
||||
|
||||
Logger.info("Starting connections.");
|
||||
|
||||
for (var n in this.connections) {
|
||||
this[n] = this.connections[n];
|
||||
starters[n] = this.connections[n].connect;
|
||||
var starters = Object.keys(this.connections).map(function(n) {
|
||||
var conn = this[n] = this.connections[n];
|
||||
|
||||
return function(cb) {
|
||||
var str = "Starting connection '" + n + "'";
|
||||
|
||||
if (conn.host) {
|
||||
str += " on host " + conn.host;
|
||||
} else if (conn.port) {
|
||||
str += " on port " + conn.port;
|
||||
}
|
||||
|
||||
Logger.debug(str + ".");
|
||||
return conn.connect.call(conn, cb);
|
||||
};
|
||||
}.bind(this));
|
||||
|
||||
return Async.parallel(starters, callback);
|
||||
};
|
||||
|
||||
|
@ -351,15 +361,23 @@ Robot.prototype.startConnections = function(callback) {
|
|||
//
|
||||
// Returns nothing
|
||||
Robot.prototype.startDevices = function(callback) {
|
||||
var starters = {};
|
||||
|
||||
Logger.info("Starting devices.");
|
||||
|
||||
for (var n in this.devices) {
|
||||
this[n] = this.devices[n];
|
||||
starters[n] = this.devices[n].start.bind(this.devices[n]);
|
||||
var starters = Object.keys(this.devices).map(function(n) {
|
||||
var device = this[n] = this.devices[n];
|
||||
|
||||
return function(cb) {
|
||||
var str = "Starting device '" + n + "'";
|
||||
|
||||
if (device.pin) {
|
||||
str += " on pin " + device.pin;
|
||||
}
|
||||
|
||||
Logger.debug(str + ".");
|
||||
return device.start.call(device, cb);
|
||||
};
|
||||
}.bind(this));
|
||||
|
||||
return Async.parallel(starters, callback);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue