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:
parent
2ec349aa85
commit
a85d530384
45 changed files with 46 additions and 352 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue