From 0403b5ab94d3a1d29466300e997bf60d2bce8704 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Tue, 2 Aug 2016 11:37:43 -0300 Subject: [PATCH] skip log for notification requests --- lib/expressapp.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/expressapp.js b/lib/expressapp.js index da766cb..e0dcfd1 100644 --- a/lib/expressapp.js +++ b/lib/expressapp.js @@ -65,9 +65,14 @@ ExpressApp.prototype.start = function(opts, cb) { return req.copayerId }); - - - this.app.use(morgan(' :remote-addr :date[iso] ":method :url" :status :res[content-length] :response-time ":user-agent" :walletId :copayerId')); + var logFormat = ':remote-addr :date[iso] ":method :url" :status :res[content-length] :response-time ":user-agent" :walletId :copayerId'; + var logOpts = { + skip: function(req, res) { + if (res.statusCode != 200) return false; + return req.path.indexOf('/notifications/') >= 0; + } + }; + this.app.use(morgan(logFormat, logOpts)); }