diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-26 17:52:14 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-26 18:05:47 +0200 |
commit | 85b4d9c52eb8a6b3b54152cca5c6edde481c863c (patch) | |
tree | eec0fbda814f955df1f163922c7d0ba3f7b43441 /scripts/parse-log.ts | |
parent | 9b67da3d9bc951c624f17dce7821036f8518d893 (diff) | |
download | PeerTube-85b4d9c52eb8a6b3b54152cca5c6edde481c863c.tar.gz PeerTube-85b4d9c52eb8a6b3b54152cca5c6edde481c863c.tar.zst PeerTube-85b4d9c52eb8a6b3b54152cca5c6edde481c863c.zip |
Upgrade dependencies
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({ |