From b678942b4d41c2d666bd6cce3a55cfc442a1c10c Mon Sep 17 00:00:00 2001 From: Martin Toman Date: Wed, 12 Jun 2019 20:56:22 +0200 Subject: [PATCH 1/2] Fix logger --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 19e87e7..ddf35da 100644 --- a/index.js +++ b/index.js @@ -17,14 +17,14 @@ app.get('/unsubscribe/:email', function (req, res) { if (req.params.email) { const email = validator.parseOneAddress(req.params.email) if (email === null) { - logger.warning(`Got invalid email address : ${req.params.email}`) + logger.info(`Got invalid email address : ${req.params.email}`) } else { subscription.unsubscribe(email.address) } } else { - logger.warning('got no email address - ignoring request') + logger.info('got no email address - ignoring request') } res.redirect('/unsubscribed') }) @@ -32,7 +32,7 @@ app.get('/subscribe/:email', function (req, res) { if (req.params.email) { const email = validator.parseOneAddress(req.params.email) if (email === null) { - logger.warning(`Got invalid email address : ${req.params.email}`) + logger.info(`Got invalid email address : ${req.params.email}`) res.status(400).send('invalid email') } else { From 2c8e4365dd6937c43c9aeac2eeb2841075ccaff5 Mon Sep 17 00:00:00 2001 From: Martin Toman Date: Thu, 20 Jun 2019 11:29:27 +0200 Subject: [PATCH 2/2] Fix error logging --- subscription.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subscription.js b/subscription.js index 32d0918..858a2d7 100644 --- a/subscription.js +++ b/subscription.js @@ -11,10 +11,10 @@ module.exports = function (mailgun) { }, function (err, body) { if (err) { - logger.error(`could not ${sub ? '' : 'un'}subscribe : ${email} : ${err} : ${body}`) + logger.error(`could not ${sub ? '' : 'un'}subscribe : ${email} : ${err}`) } else { - logger.debug(`${sub ? '' : 'un'}subscribed : ${email} : ${body}`) + logger.debug(`${sub ? '' : 'un'}subscribed : ${email}`) } }) }