Batch Queries: use path instead of stream to be able to reopen FD

This commit is contained in:
Raul Ochoa 2016-10-03 13:28:13 +02:00
parent ccbadf4ab4
commit 6c2db4385c
2 changed files with 12 additions and 5 deletions

View File

@ -1,6 +1,9 @@
1.36.2 - 2016-mm-dd
-------------------
Bug fixes:
- Batch Queries logs: use path instead of stream to be able to reopen FD.
1.36.1 - 2016-09-30
-------------------

View File

@ -1,16 +1,20 @@
'use strict';
var bunyan = require('bunyan');
var fs = require('fs');
function BatchLogger (path) {
var stream = {
level: 'info'
};
if (path) {
stream.path = path;
} else {
stream.stream = process.stdout;
}
this.path = path;
this.logger = bunyan.createLogger({
name: 'batch-queries',
streams: [{
level: 'info',
stream: path ? fs.createWriteStream(path, { flags: 'a', encoding: 'utf8' }) : process.stdout
}]
streams: [stream]
});
}