From ba93049c4da370f766cfe57330567ede00be128c Mon Sep 17 00:00:00 2001 From: rob Date: Sat, 18 Dec 2021 20:31:47 -0500 Subject: [PATCH] link visit logging --- app/controllers/link.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/link.js b/app/controllers/link.js index aead20d..8c832b2 100644 --- a/app/controllers/link.js +++ b/app/controllers/link.js @@ -68,6 +68,8 @@ class LinkController extends SiteController { async postCreateLinkVisit (req, res, next) { const { link: linkService, resource: resourceService } = this.dtp.services; try { + this.log.info('recording link visit', { link: res.locals.link._id, ip: req.ip }); + /* * Do these jobs in parallel so the total work gets done faster */ @@ -75,7 +77,8 @@ class LinkController extends SiteController { linkService.recordVisit(res.locals.link, req), resourceService.recordView(req, 'Link', res.locals.link._id), ]; - await Promise.all(jobs); // we don't care about any specific results + + await Promise.all(jobs); res.redirect(res.locals.link.href); // off you go! } catch (error) {