Skip to content

Commit

Permalink
Merge branch 'main' into removeIPFromLogs
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall authored Feb 27, 2024
2 parents 5dc3354 + 9ca1578 commit c3c32b4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 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
5 changes: 3 additions & 2 deletions src/utils/logging.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import logger from '../utils/logger.js'
import hash from '../utils/hasher.js'

const logPageView = async (route, sessionID) => {

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

Expand Down

0 comments on commit c3c32b4

Please sign in to comment.