Fix: Allow proper logging of node.js Error objects.
See: https://github.com/bluejamesbond/Scribe.js/issues/70
This commit is contained in:
parent
744281751e
commit
6214404b64
|
@ -42,6 +42,20 @@ angular.module('ffffng').factory('Logger', function (app) {
|
|||
app.use(prefix + '/internal/logs', scribe.webPanel());
|
||||
}
|
||||
|
||||
// Hack to allow correct logging of node.js Error objects.
|
||||
// See: https://github.com/bluejamesbond/Scribe.js/issues/70
|
||||
Object.defineProperty(Error.prototype, 'toJSON', {
|
||||
configurable: true,
|
||||
value: function () {
|
||||
var alt = {};
|
||||
var storeKey = function (key) {
|
||||
alt[key] = this[key];
|
||||
};
|
||||
Object.getOwnPropertyNames(this).forEach(storeKey, this);
|
||||
return alt;
|
||||
}
|
||||
});
|
||||
|
||||
return process.console;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue