aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-17 14:58:40 +0200
committerChocobozzz <me@florianbigard.com>2022-08-17 14:58:40 +0200
commita85d530384761a0af833caac9b38b9834517c9fa (patch)
tree5407dbcc32b6324067632d4c99f25a6b7d851230 /server/middlewares/validators/shared
parent2ec349aa857b0bd8f26de5cd78981d60c9b98a69 (diff)
downloadPeerTube-a85d530384761a0af833caac9b38b9834517c9fa.tar.gz
PeerTube-a85d530384761a0af833caac9b38b9834517c9fa.tar.zst
PeerTube-a85d530384761a0af833caac9b38b9834517c9fa.zip
Remove unnecessary logs
Diffstat (limited to 'server/middlewares/validators/shared')
-rw-r--r--server/middlewares/validators/shared/utils.ts27
1 files changed, 26 insertions, 1 deletions
diff --git a/server/middlewares/validators/shared/utils.ts b/server/middlewares/validators/shared/utils.ts
index 77b64bc7a..f39128fdd 100644
--- a/server/middlewares/validators/shared/utils.ts
+++ b/server/middlewares/validators/shared/utils.ts
@@ -3,7 +3,32 @@ import { param, validationResult } from 'express-validator'
3import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' 3import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc'
4import { logger } from '../../../helpers/logger' 4import { logger } from '../../../helpers/logger'
5 5
6function areValidationErrors (req: express.Request, res: express.Response) { 6function areValidationErrors (
7 req: express.Request,
8 res: express.Response,
9 options: {
10 omitLog?: boolean
11 omitBodyLog?: boolean
12 tags?: string[]
13 } = {}) {
14 const { omitLog = false, omitBodyLog = false, tags = [] } = options
15
16 if (!omitLog) {
17 logger.debug(
18 'Checking %s - %s parameters',
19 req.method, req.originalUrl,
20 {
21 body: omitBodyLog
22 ? 'omitted'
23 : req.body,
24 params: req.params,
25 query: req.query,
26 files: req.files,
27 tags
28 }
29 )
30 }
31
7 const errors = validationResult(req) 32 const errors = validationResult(req)
8 33
9 if (!errors.isEmpty()) { 34 if (!errors.isEmpty()) {