aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/parse-log.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-26 17:52:14 +0200
committerChocobozzz <me@florianbigard.com>2018-06-26 18:05:47 +0200
commit85b4d9c52eb8a6b3b54152cca5c6edde481c863c (patch)
treeeec0fbda814f955df1f163922c7d0ba3f7b43441 /scripts/parse-log.ts
parent9b67da3d9bc951c624f17dce7821036f8518d893 (diff)
downloadPeerTube-85b4d9c52eb8a6b3b54152cca5c6edde481c863c.tar.gz
PeerTube-85b4d9c52eb8a6b3b54152cca5c6edde481c863c.tar.zst
PeerTube-85b4d9c52eb8a6b3b54152cca5c6edde481c863c.zip
Upgrade dependencies
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({