logger's exception handling, monkeypatching must be explicitly enabled.

Otherwise cucumber's cleanup on uncaught exceptions in
features/support/env.js doesn't get called.
This commit is contained in:
Atul Varma 2013-08-12 16:10:16 -04:00
Родитель 42092e6a78
Коммит 5ddf6ad175
2 изменённых файлов: 18 добавлений и 12 удалений

Просмотреть файл

@ -1,12 +1,16 @@
#!/usr/bin/env node
var validatorService = require('../');
validatorService.logger.init();
if ( process.env.NEW_RELIC_HOME ) {
require( 'newrelic' );
}
const PORT = process.env['PORT'] || 8888;
var app = require('../').app.build();
var app = validatorService.app.build();
app.listen(PORT, function() {
console.log("Listening on port " + PORT + ".");
});

Просмотреть файл

@ -46,16 +46,18 @@ log.middleware = function middleware() {
};
};
// Ensure uncaught exceptions end up in the event stream too
process.once('uncaughtException', function (err) {
log.fatal(err);
throw err;
});
log.init = function init() {
// Ensure uncaught exceptions end up in the event stream too
process.once('uncaughtException', function (err) {
log.fatal(err);
throw err;
});
// Patch console so it only outputs to stderr
console.log = function() {
process.stderr.write(util.format.apply(this, arguments) + '\n');
// Patch console so it only outputs to stderr
console.log = function() {
process.stderr.write(util.format.apply(this, arguments) + '\n');
};
console.dir = function(object) {
process.stderr.write(util.inspect(object) + '\n');
};
};
console.dir = function(object) {
process.stderr.write(util.inspect(object) + '\n');
};