Skip to content

Commit

Permalink
Merge pull request #66 from digital-land/fixPageViewLogging
Browse files Browse the repository at this point in the history
Fix page view logging
  • Loading branch information
GeorgeGoodall authored Feb 27, 2024
2 parents 405c367 + 6150ee9 commit 9ca1578
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/controllers/pageController.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class PageController extends Controller {
super.locals(req, res, callback)
}

async get (req, res, next) {
await logPageView(this.options.route, req.sessionID, req.ip)
get (req, res, next) {
logPageView(this.options.route, req.sessionID, req.ip)
super.get(req, res, next)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/uploadController.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import logger from '../utils/logger.js'
class UploadController extends PageController {
apiRoute = config.api.url + config.api.validationEndpoint

async get (req, res, next) {
get (req, res, next) {
req.form.options.validationError = this.validationErrorMessage
super.get(req, res, next)
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/logging.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import logger from '../utils/logger.js'
import hash from '../utils/hasher.js'

const logPageView = async (route, sessionID, ipAddress) => {
const logPageView = (route, sessionID, ipAddress) => {
logger.info({
type: 'PageView',
pageRoute: route,
message: `page view occurred for page: ${route}`,
sessionId: await hash(sessionID),
ipAddress: await hash(ipAddress)
sessionId: hash(sessionID),
ipAddress: hash(ipAddress)
})
}

Expand Down

0 comments on commit 9ca1578

Please sign in to comment.