1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Remove unnecessary logs

This commit is contained in:
Chocobozzz 2022-08-17 14:58:40 +02:00
parent 2ec349aa85
commit a85d530384
No known key found for this signature in database
GPG key ID: 583A612D890159BE
45 changed files with 46 additions and 352 deletions

View file

@ -3,7 +3,32 @@ import { param, validationResult } from 'express-validator'
import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc'
import { logger } from '../../../helpers/logger'
function areValidationErrors (req: express.Request, res: express.Response) {
function areValidationErrors (
req: express.Request,
res: express.Response,
options: {
omitLog?: boolean
omitBodyLog?: boolean
tags?: string[]
} = {}) {
const { omitLog = false, omitBodyLog = false, tags = [] } = options
if (!omitLog) {
logger.debug(
'Checking %s - %s parameters',
req.method, req.originalUrl,
{
body: omitBodyLog
? 'omitted'
: req.body,
params: req.params,
query: req.query,
files: req.files,
tags
}
)
}
const errors = validationResult(req)
if (!errors.isEmpty()) {