forked from javascript-tutorial/server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstreams.js
More file actions
executable file
·45 lines (40 loc) · 947 Bytes
/
streams.js
File metadata and controls
executable file
·45 lines (40 loc) · 947 Bytes
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
const RequestCaptureStream = require('./requestCaptureStream');
var 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
}];
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
})
}
];
}
}
module.exports = streams;