diff options
author | Florent <florent.git@zeteo.me> | 2022-08-16 08:06:49 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-08-16 10:32:53 +0200 |
commit | 045224d5eb6a41081186c4040bab1570b9d9ad65 (patch) | |
tree | 514367d323f1a35ff6c5a618a6addade98fd11c2 /scripts | |
parent | cbdbee807ddc202901fd61f1af4ca2988d2268b5 (diff) | |
download | PeerTube-045224d5eb6a41081186c4040bab1570b9d9ad65.tar.gz PeerTube-045224d5eb6a41081186c4040bab1570b9d9ad65.tar.zst PeerTube-045224d5eb6a41081186c4040bab1570b9d9ad65.zip |
Allow continusously printing logs through tail and parse-log
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/parse-log.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/parse-log.ts b/scripts/parse-log.ts index 5a420a46c..6770f090b 100755 --- a/scripts/parse-log.ts +++ b/scripts/parse-log.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { program } from 'commander' | 1 | import { program } from 'commander' |
2 | import { createReadStream, readdir } from 'fs-extra' | 2 | import { createReadStream, readdir } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { stdin } from 'process' | ||
4 | import { createInterface } from 'readline' | 5 | import { createInterface } from 'readline' |
5 | import { format as sqlFormat } from 'sql-formatter' | 6 | import { format as sqlFormat } from 'sql-formatter' |
6 | import { inspect } from 'util' | 7 | import { inspect } from 'util' |
@@ -89,7 +90,7 @@ async function run () { | |||
89 | function readFile (file: string) { | 90 | function readFile (file: string) { |
90 | console.log('Opening %s.', file) | 91 | console.log('Opening %s.', file) |
91 | 92 | ||
92 | const stream = createReadStream(file) | 93 | const stream = file === '-' ? stdin : createReadStream(file) |
93 | 94 | ||
94 | const rl = createInterface({ | 95 | const rl = createInterface({ |
95 | input: stream | 96 | input: stream |
@@ -117,7 +118,7 @@ function readFile (file: string) { | |||
117 | } | 118 | } |
118 | }) | 119 | }) |
119 | 120 | ||
120 | stream.once('close', () => res()) | 121 | stream.once('end', () => res()) |
121 | }) | 122 | }) |
122 | } | 123 | } |
123 | 124 | ||