diff --git a/lib/adaptor.js b/lib/adaptor.js index 1d6f5a0..080ad71 100644 --- a/lib/adaptor.js +++ b/lib/adaptor.js @@ -51,13 +51,14 @@ Adaptor.prototype.commands = function() { // // Returns nothing Adaptor.prototype.connect = function(callback) { - Logger.info("Connecting to adaptor '" + this.name + "'..."); + Logger.info("Connecting to adaptor '" + this.name + "'."); callback(null); + return true; }; // Public: Disconnects from the adaptor // // Returns nothing Adaptor.prototype.disconnect = function() { - return Logger.info("Disconnecting from adaptor '" + this.name + "'..."); + Logger.info("Disconnecting from adaptor '" + this.name + "'."); }; diff --git a/lib/connection.js b/lib/connection.js index 93a39dd..1883846 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -70,11 +70,14 @@ Connection.prototype.toJSON = function() { // Returns the result of the supplied callback function Connection.prototype.connect = function(callback) { var msg = "Connecting to " + this.name; + var msg = "Connecting to '" + this.name + "'"; if (this.port != null) { msg += " on port " + this.port; } + msg += "."; + Logger.info(msg); return this.adaptor.connect(callback); }; @@ -83,12 +86,14 @@ Connection.prototype.connect = function(callback) { // // Returns nothing Connection.prototype.disconnect = function() { - var msg = "Disconnecting from " + this.name; + var msg = "Disconnecting from '" + this.name + "'"; if (this.port != null) { msg += " on port " + this.port; } + msg += "."; + Logger.info(msg); return this.adaptor.disconnect(); }; @@ -100,7 +105,7 @@ Connection.prototype.disconnect = function() { // // Returns the set-up adaptor Connection.prototype.initAdaptor = function(opts) { - Logger.debug("Loading adaptor '" + opts.adaptor + "'"); + Logger.debug("Loading adaptor '" + opts.adaptor + "'."); return this.robot.initAdaptor(opts.adaptor, this.self, opts); }; diff --git a/lib/device.js b/lib/device.js index adcb1b4..806f8c9 100644 --- a/lib/device.js +++ b/lib/device.js @@ -54,12 +54,14 @@ Utils.subclass(Device, EventEmitter); // // Returns result of supplied callback Device.prototype.start = function(callback) { - var msg = "Starting device " + this.name; + var msg = "Starting device '" + this.name + "'"; if (this.pin != null) { msg += " on pin " + this.pin; } + msg += "."; + Logger.info(msg); return this.driver.start(callback); }; @@ -68,7 +70,7 @@ Device.prototype.start = function(callback) { // // Returns result of supplied callback Device.prototype.halt = function() { - Logger.info("Halting device " + this.name); + Logger.info("Halting device '" + this.name + "'."); return this.driver.halt(); }; @@ -116,6 +118,6 @@ Device.prototype.defaultConnection = function() { // Returns the set-up driver Device.prototype.initDriver = function(opts) { if (opts == null) { opts = {}; } - Logger.debug("Loading driver '" + opts.driver + "'"); + Logger.debug("Loading driver '" + opts.driver + "'."); return this.robot.initDriver(opts.driver, this.self, opts); }; diff --git a/lib/driver.js b/lib/driver.js index 1060aba..7e82616 100644 --- a/lib/driver.js +++ b/lib/driver.js @@ -51,7 +51,7 @@ Driver.prototype.commands = function() { // // Returns nothing Driver.prototype.start = function(callback) { - Logger.info("Driver " + this.name + " started"); + Logger.info("Driver " + this.name + " started."); callback(null); return true; }; @@ -60,5 +60,5 @@ Driver.prototype.start = function(callback) { // // Returns nothing Driver.prototype.halt = function() { - return Logger.info("Driver " + this.name + " halted"); + Logger.info("Driver " + this.name + " halted."); }; diff --git a/test/specs/adaptor.spec.js b/test/specs/adaptor.spec.js index 735cce7..febb8e1 100644 --- a/test/specs/adaptor.spec.js +++ b/test/specs/adaptor.spec.js @@ -56,7 +56,7 @@ describe("Adaptor", function() { }); it("logs that it's connecting to the adaptor", function() { - var string = "Connecting to adaptor 'adaptor'..."; + var string = "Connecting to adaptor 'adaptor'."; expect(Logger.info).to.be.calledWith(string); }); @@ -76,7 +76,7 @@ describe("Adaptor", function() { }); it("logs that it's disconnecting to the adaptor", function() { - var string = "Disconnecting from adaptor 'adaptor'..."; + var string = "Disconnecting from adaptor 'adaptor'."; expect(Logger.info).to.be.calledWith(string); }); }); diff --git a/test/specs/connection.spec.js b/test/specs/connection.spec.js index 4005cdf..33b1a6a 100644 --- a/test/specs/connection.spec.js +++ b/test/specs/connection.spec.js @@ -4,7 +4,7 @@ var Robot = source("robot"), Logger = source('logger'), Utils = source('utils'); -describe("Cylon.Connection", function() { +describe("Connection", function() { var robot = new Robot({ name: "Robby", connection: { name: 'loopback', adaptor: 'loopback', port: "/dev/null" } @@ -71,7 +71,7 @@ describe("Cylon.Connection", function() { }); it("logs that it's connecting the device", function() { - var message = "Connecting to loopback on port /dev/null"; + var message = "Connecting to 'loopback' on port /dev/null."; expect(Logger.info).to.be.calledWith(message); }); @@ -94,7 +94,7 @@ describe("Cylon.Connection", function() { }); it("logs that it's disconnecting from the device", function() { - var message = "Disconnecting from loopback on port /dev/null"; + var message = "Disconnecting from 'loopback' on port /dev/null."; expect(Logger.info).to.be.calledWith(message); }); diff --git a/test/specs/device.spec.js b/test/specs/device.spec.js index 198a91a..025558c 100644 --- a/test/specs/device.spec.js +++ b/test/specs/device.spec.js @@ -6,7 +6,7 @@ var Ping = source('test/ping'), Logger = source('logger'), Utils = source('utils'); -describe("Cylon.Device", function() { +describe("Device", function() { var robot = new Robot({ name: "TestingBot", connection: { name: 'loopback', adaptor: 'loopback' } @@ -75,7 +75,7 @@ describe("Cylon.Device", function() { it("logs that it's starting the device", function() { stub(Logger, 'info'); - var message = "Starting device ping on pin 13"; + var message = "Starting device 'ping' on pin 13."; device.start() @@ -100,7 +100,7 @@ describe("Cylon.Device", function() { }); it("logs that it's halt the device", function() { - var message = "Halting device ping"; + var message = "Halting device 'ping'."; stub(Logger, 'info'); device.halt(); diff --git a/test/specs/driver.spec.js b/test/specs/driver.spec.js index 98c0f32..91478a8 100644 --- a/test/specs/driver.spec.js +++ b/test/specs/driver.spec.js @@ -67,7 +67,7 @@ describe("Driver", function() { }); it("logs that it's starting the driver", function() { - var string = "Driver driver started"; + var string = "Driver driver started."; expect(Logger.info).to.be.calledWith(string); }); @@ -87,7 +87,7 @@ describe("Driver", function() { }); it("logs that it's halting the driver", function() { - expect(Logger.info).to.be.calledWith("Driver driver halted") + expect(Logger.info).to.be.calledWith("Driver driver halted.") }); }); });