-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathstreams.js
More file actions
executable file
·52 lines (48 loc) · 1.11 KB
/
Copy pathstreams.js
File metadata and controls
executable file
·52 lines (48 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const RequestCaptureStream = require('./requestCaptureStream');
const DebugStream = require('./debugStream');
let streams;
if (process.env.LOG_LEVEL) {
streams = [{
level: process.env.LOG_LEVEL,
stream: process.stdout
}];
} else {
switch (process.env.NODE_ENV) {
case 'development':
streams = [{
level: 'debug',
stream: process.stdout
}, {
level: 'debug',
stream: new DebugStream()
}];
break;
case 'test':
streams = [/* empty, don't log anything, set LOG_LEVEL if want to see errors */];
break;
case 'ebook':
case 'production':
// normally I see only info, but look in error in case of problems
streams = [
{
level: 'info',
stream: process.stdout
},
{
level: 'debug',
type: 'raw',
stream: new RequestCaptureStream({
level: 'error',
maxRecords: 150,
maxRequestIds: 2000,
stream: process.stderr
})
},
{
level: 'debug',
stream: new DebugStream()
},
];
}
}
module.exports = streams;