Batch Queries: use path instead of stream to be able to reopen FD
This commit is contained in:
parent
ccbadf4ab4
commit
6c2db4385c
3
NEWS.md
3
NEWS.md
@ -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
|
||||
-------------------
|
||||
|
@ -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]
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user