'make check'

This commit is contained in:
Trent Mick 2014-05-31 22:25:06 -07:00
parent 7fb58aa5e4
commit 42e99323ee
5 changed files with 29 additions and 28 deletions

View file

@ -8,7 +8,8 @@ Known issues:
## bunyan 0.23.1 (not yet released)
- #97 Unref rotating-file timeout which was preventing processes from exiting
- [issue #97] Unref rotating-file timeout which was preventing processes from
exiting.
## bunyan 0.23.0

View file

@ -35,19 +35,19 @@ SpecificLevelStream.prototype.write = function (rec) {
var log1 = bunyan.createLogger({
name: 'use-case-1',
streams: [{
streams: [ {
level: 'trace',
type: 'raw',
stream: new SpecificLevelStream(
['trace', 'debug', 'info', 'warn'],
process.stdout)
},{
}, {
level: 'error',
type: 'raw',
stream: new SpecificLevelStream(
['error'],
process.stderr)
}]
} ]
});
log1.info('hi at info level (this should be on stdout)');
@ -59,18 +59,17 @@ log1.error('alert alert (this should be on stderr)');
*/
var log2 = bunyan.createLogger({
name: 'use-case-2',
streams: [{
streams: [ {
level: 'info',
type: 'raw',
stream: new SpecificLevelStream(
['info'],
fs.createWriteStream('specific-level-stream-http.log',
fs.createWriteStream('specific-level-streams-http.log',
{flags: 'a', encoding: 'utf8'}))
},{
}, {
level: 'warn',
path: 'specific-level-stream-http.err.log'
}
]
path: 'specific-level-streams-http.err.log'
} ]
});
log2.info('200 GET /blah');

View file

@ -1017,8 +1017,8 @@ RotatingFileStream.prototype._setupNextRot = function () {
this.timeout = setTimeout(
function () { self.rotate(); },
this.rotAt - Date.now());
if (typeof this.timeout.unref === 'function') {
this.timeout.unref();
if (typeof (this.timeout.unref) === 'function') {
this.timeout.unref();
}
}

View file

@ -1,11 +1,11 @@
var bunyan = require('../lib/bunyan');
var log = bunyan.createLogger({
name: 'default',
streams: [{
type: 'rotating-file',
path: __dirname + '/log.test.rot.log',
period: '1d',
count: 7
}]
name: 'default',
streams: [ {
type: 'rotating-file',
path: __dirname + '/log.test.rot.log',
period: '1d',
count: 7
} ]
});
console.log('done');
console.log('done');

View file

@ -7,15 +7,16 @@ var exec = require('child_process').exec;
// node-tap API
if (require.cache[__dirname + '/tap4nodeunit.js'])
delete require.cache[__dirname + '/tap4nodeunit.js'];
delete require.cache[__dirname + '/tap4nodeunit.js'];
var tap4nodeunit = require('./tap4nodeunit.js');
var test = tap4nodeunit.test;
test('log with rotating file stream will terminate gracefully', function (t) {
exec('node ' +__dirname + '/process-exit.js', {timeout: 1000}, function(err, stdout, stderr) {
t.ifError(err);
t.equal(stdout, 'done\n');
t.equal(stderr, '');
t.end();
});
});
exec('node ' +__dirname + '/process-exit.js', {timeout: 1000},
function (err, stdout, stderr) {
t.ifError(err);
t.equal(stdout, 'done\n');
t.equal(stderr, '');
t.end();
});
});