X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Fparse-log.ts;h=3679dab747c02c632718da931f77507be4beafd2;hb=6c9c3b7b14411a854c8dcf8583d56b314e45a4ce;hp=045348e8674d158a376249e9e2eb423b4693eb3f;hpb=cb5c2abc99c2e222fe18621f79cb68b805678e15;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/parse-log.ts b/scripts/parse-log.ts index 045348e86..3679dab74 100755 --- a/scripts/parse-log.ts +++ b/scripts/parse-log.ts @@ -17,6 +17,8 @@ program .option('-f, --files [file...]', 'Files to parse. If not provided, the script will parse the latest log file from config)') .parse(process.argv) +const options = program.opts() + const excludedKeys = { level: true, message: true, @@ -38,7 +40,7 @@ const loggerFormat = winston.format.printf((info) => { if (CONFIG.LOG.PRETTIFY_SQL) { additionalInfos += '\n' + sqlFormat(info.sql, { language: 'sql', - ident: ' ' + indent: ' ' }) } else { additionalInfos += ' - ' + info.sql @@ -51,7 +53,7 @@ const loggerFormat = winston.format.printf((info) => { const logger = winston.createLogger({ transports: [ new winston.transports.Console({ - level: program['level'] || 'debug', + level: options.level || 'debug', stderrLevels: [], format: winston.format.combine( winston.format.splat(), @@ -76,7 +78,7 @@ run() .catch(err => console.error(err)) function run () { - return new Promise(async res => { + return new Promise(async res => { const files = await getFiles() for (const file of files) { @@ -114,7 +116,7 @@ async function getNewestFile (files: string[], basePath: string) { } async function getFiles () { - if (program['files']) return program['files'] + if (options.files) return options.files const logFiles = await readdir(CONFIG.STORAGE.LOG_DIR)