diff options
Diffstat (limited to 'scripts/parse-log.ts')
-rwxr-xr-x | scripts/parse-log.ts | 9 |
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 @@ | |||
1 | import * as program from 'commander' | 1 | import * as program from 'commander' |
2 | import { createReadStream } from 'fs' | 2 | import { createReadStream, readdirSync } from 'fs' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { createInterface } from 'readline' | 4 | import { createInterface } from 'readline' |
5 | import * as winston from 'winston' | 5 | import * 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 | ||
32 | const logger = new winston.createLogger({ | 32 | const 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 | ||
55 | const path = join(CONFIG.STORAGE.LOG_DIR, 'peertube.log') | 55 | const logFiles = readdirSync(CONFIG.STORAGE.LOG_DIR) |
56 | const lastLogFile = logFiles[logFiles.length - 1] | ||
57 | |||
58 | const path = join(CONFIG.STORAGE.LOG_DIR, lastLogFile) | ||
56 | console.log('Opening %s.', path) | 59 | console.log('Opening %s.', path) |
57 | 60 | ||
58 | const rl = createInterface({ | 61 | const rl = createInterface({ |