diff options
-rw-r--r-- | .editorconfig | 4 | ||||
-rwxr-xr-x | scripts/parse-log.ts | 5 | ||||
-rw-r--r-- | support/doc/development/tests.md | 13 |
3 files changed, 18 insertions, 4 deletions
diff --git a/.editorconfig b/.editorconfig index b7d3033f3..843d5d926 100644 --- a/.editorconfig +++ b/.editorconfig | |||
@@ -7,11 +7,11 @@ root = true | |||
7 | end_of_line = lf | 7 | end_of_line = lf |
8 | charset = utf-8 | 8 | charset = utf-8 |
9 | 9 | ||
10 | [*.yml] | 10 | [*.{yml,html}] |
11 | indent_style = space | 11 | indent_style = space |
12 | indent_size = 2 | 12 | indent_size = 2 |
13 | 13 | ||
14 | [{client,server,shared}/**.{ts,json,js}] | 14 | [{client,server,shared,scripts}/**.{ts,json,js}] |
15 | trim_trailing_whitespace = true | 15 | trim_trailing_whitespace = true |
16 | insert_final_newline = true | 16 | insert_final_newline = true |
17 | indent_style = space | 17 | indent_style = space |
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 | ||
diff --git a/support/doc/development/tests.md b/support/doc/development/tests.md index 52e7993b2..207d4f984 100644 --- a/support/doc/development/tests.md +++ b/support/doc/development/tests.md | |||
@@ -79,6 +79,19 @@ While testing, you might want to display a server's logs to understand why they | |||
79 | NODE_APP_INSTANCE=1 NODE_ENV=test npm run parse-log -- --level debug | less +GF | 79 | NODE_APP_INSTANCE=1 NODE_ENV=test npm run parse-log -- --level debug | less +GF |
80 | ``` | 80 | ``` |
81 | 81 | ||
82 | You can also: | ||
83 | - checkout only the latest logs (PeerTube >= 5.0): | ||
84 | |||
85 | ```bash | ||
86 | tail -n 100 test1/logs/peertube.log | npm run parse-log -- --level debug --files - | ||
87 | ``` | ||
88 | |||
89 | - continuously print the latests logs (PeerTube >= 5.0): | ||
90 | |||
91 | ```bash | ||
92 | tail -f test1/logs/peertube.log | npm run parse-log -- --level debug --files - | ||
93 | ``` | ||
94 | |||
82 | 95 | ||
83 | ## Client E2E tests | 96 | ## Client E2E tests |
84 | 97 | ||