mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-10 21:05:09 +00:00
update logger from upstream
This commit is contained in:
parent
5df4ff7418
commit
809ed3d90e
@ -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);
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user