diff --git a/lib/robot.js b/lib/robot.js index 587faa5..df96513 100644 --- a/lib/robot.js +++ b/lib/robot.js @@ -147,8 +147,6 @@ Robot.prototype.initRobot = function(opts) { // // Returns initialized connections Robot.prototype.initConnections = function(opts) { - var str; - this.log("info", "Initializing connections."); if (opts.connection == null && opts.connections == null) { @@ -156,11 +154,7 @@ Robot.prototype.initConnections = function(opts) { } if (opts.connection) { - str = "Specifying a single connection with the 'connection' key "; - str += "is deprecated. It will be removed in 1.0.0."; - - this.log("warn", str); - + this.deprecationWarning("connection"); this.connection(opts.connection.name, opts.connection); return this.connections; } @@ -231,8 +225,6 @@ Robot.prototype.device = function(name, device) { // // Returns initialized devices Robot.prototype.initDevices = function(opts) { - var str; - this.log("info", "Initializing devices."); if (opts.device == null && opts.devices == null) { @@ -245,10 +237,7 @@ Robot.prototype.initDevices = function(opts) { } if (opts.device) { - str = "Specifying a single device with the 'device' key is deprecated. "; - str += "It will be removed in 1.0.0."; - - this.log("warn", str); + this.deprecationWarning("device"); this.device(opts.device.name, opts.device); return this.devices; } @@ -439,3 +428,14 @@ Robot.prototype.performArraySetup = function(things, typeOfThing, arrayName) { this[typeOfThing](name, t); }, this); }; + +Robot.prototype.deprecationWarning = function(kind) { + var msg = "Specifying a single "; + msg += kind; + msg += " with the '"; + msg += kind; + msg += "' key "; + msg += "is deprecated. It will be removed in 1.0.0."; + + this.log("warn", msg); +};