aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/parse-log.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/parse-log.ts')
-rwxr-xr-xscripts/parse-log.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/parse-log.ts b/scripts/parse-log.ts
index 9f67c0d53..4e4f3df63 100755
--- a/scripts/parse-log.ts
+++ b/scripts/parse-log.ts
@@ -1,5 +1,5 @@
1import * as program from 'commander' 1import * as program from 'commander'
2import { createReadStream } from 'fs' 2import { createReadStream, readdirSync } from 'fs'
3import { join } from 'path' 3import { join } from 'path'
4import { createInterface } from 'readline' 4import { createInterface } from 'readline'
5import * as winston from 'winston' 5import * as winston from 'winston'
@@ -29,7 +29,7 @@ const loggerFormat = winston.format.printf((info) => {
29 return `[${info.label}] ${toTimeFormat(info.timestamp)} ${info.level}: ${info.message}${additionalInfos}` 29 return `[${info.label}] ${toTimeFormat(info.timestamp)} ${info.level}: ${info.message}${additionalInfos}`
30}) 30})
31 31
32const logger = new winston.createLogger({ 32const logger = winston.createLogger({
33 transports: [ 33 transports: [
34 new winston.transports.Console({ 34 new winston.transports.Console({
35 level: program['level'] || 'debug', 35 level: program['level'] || 'debug',
@@ -52,7 +52,10 @@ const logLevels = {
52 debug: logger.debug.bind(logger) 52 debug: logger.debug.bind(logger)
53} 53}
54 54
55const path = join(CONFIG.STORAGE.LOG_DIR, 'peertube.log') 55const logFiles = readdirSync(CONFIG.STORAGE.LOG_DIR)
56const lastLogFile = logFiles[logFiles.length - 1]
57
58const path = join(CONFIG.STORAGE.LOG_DIR, lastLogFile)
56console.log('Opening %s.', path) 59console.log('Opening %s.', path)
57 60
58const rl = createInterface({ 61const rl = createInterface({