Parse global stream config option
This commit is contained in:
parent
0d5021eebc
commit
a989f4d60c
1 changed files with 10 additions and 7 deletions
|
@ -13,13 +13,16 @@ var output;
|
||||||
if (config.get('bunyan') || config.get(env + ':use_bunyan')) {
|
if (config.get('bunyan') || config.get(env + ':use_bunyan')) {
|
||||||
var settings = _.cloneDeep(config.get(env + ':bunyan'));
|
var settings = _.cloneDeep(config.get(env + ':bunyan'));
|
||||||
|
|
||||||
for (var i = 0; i < settings.streams.length; i++) {
|
// Stream can be specified either in settings.streams[ix] or globally in settings.stream
|
||||||
if (settings.streams[i].stream === 'process.stdout') {
|
_([settings.streams, settings])
|
||||||
settings.streams[i].stream = process.stdout;
|
.flatten()
|
||||||
} else if (settings.streams[i].stream === 'process.stderr') {
|
.forEach(function (settingObj) {
|
||||||
settings.streams[i].stream = process.stderr;
|
if (settingObj.stream === 'process.stdout') {
|
||||||
}
|
settingObj.stream = process.stdout;
|
||||||
|
} else if (settingObj.stream === 'process.stderr') {
|
||||||
|
settingObj.stream = process.stderr;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
output = bunyan.createLogger(settings);
|
output = bunyan.createLogger(settings);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue