This commit adds a simplified logging system, with two primary methods:
- `Logger#log(String) :: void` (for normal logging)
- `Logger#debug(String) :: void` (for debug logging)
This helps dramatically simplify logging infrastructure, as well as
enabling simpler toggling of log modes.
The configuration values for the Logger have also been updated:
- `logger :: Function` - function to log output to (both normal + debug)
- `silent :: Boolean` - whether to log default normal messages or not (`--silent` flag)
- `debug :: Boolean` - whether or not to log debug output (`--debug` flag)
Additionally, the following CLI flags are supported re: logging:
- `--silent` disables normal logging (will override all other settings)
- `--debug` enables debug logging
Deprecation notices have been added for old log methods, with first-run
messages to this effect.
This change should have negligible impact on end-users, with minor
inconvenience for library developers, as they need to switch their
logging function calls over.
Logging configuration is still possible via both
`Cylon.Config.update(Object)`, and directly calling
`Cylon.Logger.setup(Object)`.
Removes deprecation warnings + support for single-object + array
syntaxes.
The array syntax will likely continue to work due to the `_.each`
abstraction, but since we don't use it anywhere, the requisite specs
have been removed.
e.g.
connections: {
loopback: {
adaptor: "loopback",
devices: {
ping: { driver: "ping", pin: 1 }
}
}
}
In the event of a name collision between the `devices` hash and a nested
device, the nested device will 'win'.
Simple extraction out of Connection/Device initialization code inside
Robot.
This yields an interesting boon, however - this is now a valid Cylon
program:
var Cylon = require('cylon');
Cylon
.robot()
.connection({ name: 'loopback', adaptor: 'loopback' })
.device({ name: 'ping', driver: 'ping' })
.on('ready', function(bot) {
console.log("Bot working!");
every(1000, function() {
console.log(bot.ping.ping());
})
});
Cylon.start();
For those that prefer imperative programs with Cylon, this is a nice
syntax addition.