mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-26 21:16:18 +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) {
|
_(methodsHash).each(function(colorFn, method) {
|
||||||
Logger.prototype[method] = function() {
|
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) {
|
Logger.prototype.trace = function() {
|
||||||
console.log(this._colorizeArgs(colors.red, [err.stack || err]));
|
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() {
|
Logger.prototype.time = function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user