update logger from upstream

This commit is contained in:
oleg 2016-01-25 23:28:52 +03:00
parent 5df4ff7418
commit 809ed3d90e

View File

@ -54,12 +54,22 @@ Logger.prototype._formatArgs = function(argsColorFn, args) {
_(methodsHash).each(function(colorFn, method) {
Logger.prototype[method] = function() {
console.log.call(console, this._formatArgs(colorFn, arguments));
console[method].call(console, this._formatArgs(colorFn, arguments));
};
});
Logger.prototype.trace = function(err) {
console.log(this._colorizeArgs(colors.red, [err.stack || err]));
Logger.prototype.trace = function() {
var stack = _((new Error()).stack.split('\n')).rest(2).join('\n');
var msg = 'Trace';
if (arguments.length) {
msg += ': ' + util.format.apply(util, arguments);
}
msg += '\n' + stack;
console.log(this._formatArgs(colors.red, [msg]));
};
Logger.prototype.dir = function() {
this.log(util.inspect.apply(util, arguments));
};
Logger.prototype.time = function() {
@ -71,4 +81,4 @@ Logger.prototype.timeEnd = function() {
var time = this._times[label];
if (!time) return;
this.log('%s: %dms', label, Date.now() - time);
};
};