]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Prevent uploadx too big log for config
authorChocobozzz <me@florianbigard.com>
Mon, 7 Nov 2022 09:40:43 +0000 (10:40 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 7 Nov 2022 09:40:43 +0000 (10:40 +0100)
server/lib/uploadx.ts

index cdbe7e473dc2b05767cedd0c06621375591daa9b..58040cb6d679d5c1adf613242bec5c2ffa4526e9 100644 (file)
@@ -1,7 +1,10 @@
 import express from 'express'
 import { buildLogger } from '@server/helpers/logger'
 import { getResumableUploadPath } from '@server/helpers/upload'
-import { Uploadx } from '@uploadx/core'
+import { CONFIG } from '@server/initializers/config'
+import { LogLevel, Uploadx } from '@uploadx/core'
+
+const logger = buildLogger('uploadx')
 
 const uploadx = new Uploadx({
   directory: getResumableUploadPath(),
@@ -11,7 +14,13 @@ const uploadx = new Uploadx({
   // Could be big with thumbnails/previews
   maxMetadataSize: '10MB',
 
-  logger: buildLogger('uploadx'),
+  logger: {
+    logLevel: CONFIG.LOG.LEVEL as LogLevel,
+    debug: logger.debug.bind(logger),
+    info: logger.info.bind(logger),
+    warn: logger.warn.bind(logger),
+    error: logger.error.bind(logger)
+  },
 
   userIdentifier: (_, res: express.Response) => {
     if (!res.locals.oauth) return undefined