diff --git a/src/middleware/cls.js b/src/middleware/cls.js index 31a1065891..76a26f9c4f 100644 --- a/src/middleware/cls.js +++ b/src/middleware/cls.js @@ -6,14 +6,12 @@ var namespace = continuationLocalStorage.createNamespace(NAMESPACE); var cls = function (req, res, next) { namespace.run(function() { - var value = {req: req}; + var routeData = {req: req, res: res}; + if (process.env.NODE_ENV == 'development') { - value.audit = {created: process.hrtime()}; + routeData.audit = {created: process.hrtime()}; } - namespace.set('route', { - req: req, - res: res - }); + namespace.set('route', routeData); next(); }); };