mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
Merge remote-tracking branch 'nfarina/master'
# Conflicts: # lib/logger.js
This commit is contained in:
@@ -31,7 +31,7 @@ Logger.prototype.debug = function(msg) {
|
||||
if (DEBUG_ENABLED)
|
||||
this.log.apply(this, ['debug'].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
|
||||
|
||||
Logger.prototype.info = function(msg) {
|
||||
this.log.apply(this, ['info'].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
@@ -43,35 +43,35 @@ Logger.prototype.warn = function(msg) {
|
||||
Logger.prototype.error = function(msg) {
|
||||
this.log.apply(this, ['error'].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
|
||||
|
||||
Logger.prototype.log = function(level, msg) {
|
||||
|
||||
|
||||
msg = util.format.apply(util, Array.prototype.slice.call(arguments, 1));
|
||||
func = console.log;
|
||||
|
||||
|
||||
if (level == 'debug') {
|
||||
msg = chalk.gray(msg);
|
||||
}
|
||||
else if (level == 'warn') {
|
||||
msg = chalk.yellow(msg);
|
||||
func = console.error;
|
||||
func = console.error;
|
||||
}
|
||||
else if (level == 'error') {
|
||||
msg = chalk.bold.red(msg);
|
||||
func = console.error;
|
||||
}
|
||||
|
||||
|
||||
// prepend prefix if applicable
|
||||
if (this.prefix)
|
||||
msg = chalk.cyan("[" + this.prefix + "]") + " " + msg;
|
||||
|
||||
|
||||
// prepend timestamp
|
||||
var date = new Date();
|
||||
msg = chalk.white("[" + date.toLocaleString() + "]") + " " + msg;
|
||||
|
||||
func(msg);
|
||||
}
|
||||
|
||||
|
||||
Logger.withPrefix = function(prefix) {
|
||||
|
||||
if (!loggerCache[prefix]) {
|
||||
@@ -87,6 +87,6 @@ Logger.withPrefix = function(prefix) {
|
||||
log.prefix = logger.prefix;
|
||||
loggerCache[prefix] = log;
|
||||
}
|
||||
|
||||
|
||||
return loggerCache[prefix];
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "homebridge",
|
||||
"description": "HomeKit support for the impatient",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"scripts": {
|
||||
"dev": "DEBUG=* ./bin/homebridge -D -P example-plugins/ || true"
|
||||
},
|
||||
@@ -26,7 +26,7 @@
|
||||
"dependencies": {
|
||||
"chalk": "^1.1.1",
|
||||
"commander": "2.8.1",
|
||||
"hap-nodejs": "0.2.7",
|
||||
"hap-nodejs": "0.2.8",
|
||||
"semver": "5.0.3",
|
||||
"node-persist": "^0.0.8"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user