forked from hoppity/kafka-consumer-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.js
32 lines (28 loc) · 745 Bytes
/
logger.js
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
var bunyan = require('bunyan');
var config = require('./config');
var PrettyStream = require('bunyan-prettystream');
var prettyStdOut = new PrettyStream();
prettyStdOut.pipe(process.stdout);
var streams = [];
if (config.logging.stdout && config.logging.stdout.enabled) {
streams.push({
level: config.logging.stdout.level,
type: 'raw',
stream : prettyStdOut
});
}
if (config.logging.file && config.logging.file.enabled) {
streams.push({
level: config.logging.file.level,
path: config.logging.file.path,
type: 'file'
});
}
var logger = new bunyan.createLogger({
name: config.logging.logName,
src: true,
streams: streams
});
module.exports = {
logger : logger
};