Browse Source

Log for language service

placeholder-lang-param-with-timing
Julian Simioni 6 years ago
parent
commit
782f3f0a05
No known key found for this signature in database
GPG Key ID: B9EEB0C6EE0910A1
  1. 8
      middleware/changeLanguage.js

8
middleware/changeLanguage.js

@ -32,7 +32,9 @@ function setup(service, should_execute) {
return next();
}
const start = Date.now();
service(req, res, (err, translations) => {
const requestTime = Date.now() - start;
// if there's an error, log it and bail
if (err) {
logger.info(`[middleware:language][error]`);
@ -40,6 +42,12 @@ function setup(service, should_execute) {
return next();
}
logger.info({
time: requestTime,
language: req.clean.lang.iso6391,
service: 'language',
});
// otherwise, update all the docs with translations
updateDocs(req, res, _.defaultTo(translations, []));
next();

Loading…
Cancel
Save