Skip to content

Commit

Permalink
Merge pull request #89 from lux-group/logger_fixing
Browse files Browse the repository at this point in the history
NOJIRA: Fix logging information missing
  • Loading branch information
quantang authored Jul 27, 2023
2 parents 3eedc07 + 0e9d21e commit e3e4614
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/middleware/request-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = ({ logger = console, schema, warnOnRequestValidationError }) =>

if (errors.length) {
if (warnOnRequestValidationError) {
logger.warn('[VALIDATION WARNING] Invalid url path parameters', JSON.stringify(errors))
logger.warn(`[VALIDATION WARNING] Invalid url path parameters: ${JSON.stringify(errors)}`)
} else {
throw new InvalidRequestError('Invalid url path parameters', errors)
}
Expand All @@ -17,7 +17,7 @@ module.exports = ({ logger = console, schema, warnOnRequestValidationError }) =>
let errors = schema.query.match(req.query)
if (errors.length) {
if (warnOnRequestValidationError) {
logger.warn('[VALIDATION WARNING] Invalid url query parameters', JSON.stringify(errors))
logger.warn(`[VALIDATION WARNING] Invalid url query parameters: ${JSON.stringify(errors)}`)
} else {
throw new InvalidRequestError('Invalid url query parameters', errors)
}
Expand All @@ -27,7 +27,7 @@ module.exports = ({ logger = console, schema, warnOnRequestValidationError }) =>
let errors = schema.body.match(req.body)
if (errors.length) {
if (warnOnRequestValidationError) {
logger.warn('[VALIDATION WARNING] Invalid payload', JSON.stringify(errors))
logger.warn(`[VALIDATION WARNING] Invalid payload: ${JSON.stringify(errors)}`)
} else {
throw new InvalidRequestError('Invalid payload', errors)
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@luxuryescapes/router",
"version": "2.5.25",
"version": "2.5.26",
"description": "Wrapper around express router that provides validation and documentation out of the box",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit e3e4614

Please sign in to comment.