diff --git a/lib/restbus.js b/lib/restbus.js index 6f64d38..4e2752f 100644 --- a/lib/restbus.js +++ b/lib/restbus.js @@ -19,14 +19,20 @@ app.enable('trust proxy'); // Configuration & Middleware if(app.get('env') === 'development') { - router.use(logger('dev')); + if (process.env.RESTBUS_LOGGER !== 'false') { + router.use(logger('dev')); + } + router.use(errorhandler({showStack: true, dumpExceptions: true})); router.use(function(err, req, res, next) { console.error(err.stack); res.status(500).json(utils.errors.get(500, 'The server encountered an unexpected condition: ' + err.message)); }); } else { - router.use(logger('combined')); + if (process.env.RESTBUS_LOGGER !== 'false') { + router.use(logger('combined')); + } + router.use(function(err, req, res, next) { res.status(500).json(utils.errors.get(500, 'The server encountered an unexpected condition: ' + err.message)); }); diff --git a/package-lock.json b/package-lock.json index 980229d..3866e22 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "restbus", - "version": "2.2.0", + "version": "2.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "restbus", - "version": "2.2.0", + "version": "2.3.0", "license": "MIT", "dependencies": { "compression": "1.7.4", diff --git a/package.json b/package.json index 8657a72..4cbc955 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "restbus", "description": "RESTful JSON API for the NextBus Inc. public XML feed.", - "version": "2.2.0", + "version": "2.3.0", "main": "index", "dependencies": { "compression": "1.7.4",