diff --git a/CHANGELOG.md b/CHANGELOG.md index 05674287..249d2df8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - The network column in the device list is now based on a value that gets updated in real time. The format of the column has changed slightly due to this change. - The `--mute-master` option now accepts the values `never` (default), `inuse` (only when a device is being used), and `always` (mute pre-emptively during setup phase). For backwards compatibility, `--mute-master` with no value maps to `inuse`, and `--no-mute-master` to `never`. - The battery level and battery temperature columns are now filterable with comparison operators. +- Log output now includes a timestamp. ### Fixes diff --git a/lib/util/logger.js b/lib/util/logger.js index 1f3d2d7f..3c7cf087 100644 --- a/lib/util/logger.js +++ b/lib/util/logger.js @@ -33,21 +33,21 @@ function Log(tag) { this.tag = tag this.names = { 1: 'DBG' - , 2: 'VRB' - , 3: 'INF' - , 4: 'IMP' - , 5: 'WRN' - , 6: 'ERR' - , 7: 'FTL' + , 2: 'VRB' + , 3: 'INF' + , 4: 'IMP' + , 5: 'WRN' + , 6: 'ERR' + , 7: 'FTL' } this.styles = { 1: 'grey' - , 2: 'cyan' - , 3: 'green' - , 4: 'magenta' - , 5: 'yellow' - , 6: 'red' - , 7: 'red' + , 2: 'cyan' + , 3: 'green' + , 4: 'magenta' + , 5: 'yellow' + , 6: 'red' + , 7: 'red' } this.localIdentifier = null events.EventEmitter.call(this) @@ -107,7 +107,7 @@ Log.prototype.fatal = function() { Log.prototype._entry = function(priority, args) { return new Log.Entry( - Date.now() + new Date() , priority , this.tag , process.pid @@ -117,9 +117,10 @@ Log.prototype._entry = function(priority, args) { } Log.prototype._format = function(entry) { - return util.format('%s/%s %d [%s] %s' + return util.format('%s %s/%s %d [%s] %s' + , chalk.grey(entry.timestamp.toJSON()) , this._name(entry.priority) - , entry.tag + , chalk.bold(entry.tag) , entry.pid , entry.identifier , entry.message