]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/parse-log.ts
Refractor validators
[github/Chocobozzz/PeerTube.git] / scripts / parse-log.ts
index 8aac6fbda704f0a60ad43024f2aad79d235834b5..e2c42bf4c6ca3c8ec60afb4ec054966ad7c070e1 100755 (executable)
@@ -2,7 +2,6 @@ import { createReadStream } from 'fs'
 import { join } from 'path'
 import { createInterface } from 'readline'
 import * as winston from 'winston'
-import { readFileBufferPromise } from '../server/helpers/core-utils'
 import { CONFIG } from '../server/initializers/constants'
 
 const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
@@ -16,7 +15,8 @@ const logger = new winston.Logger({
       humanReadableUnhandledException: true,
       json: false,
       colorize: true,
-      prettyPrint: true
+      prettyPrint: true,
+      stderrLevels: []
     })
   ],
   exitOnError: true
@@ -38,5 +38,11 @@ const rl = createInterface({
 
 rl.on('line', line => {
   const log = JSON.parse(line)
-  logLevels[log.level](log.message, log.stack)
+  const additionalInfo: any = {}
+
+  Object.keys(log).forEach(logKey => {
+    if (logKey !== 'message' && logKey !== 'level') additionalInfo[logKey] = log[logKey]
+  })
+
+  logLevels[log.level](log.message, additionalInfo)
 })