forked from trentm/node-bunyan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Will fail if any timers or callbacks remain registered when instantiating a logger with a rotating file.
- Loading branch information
Glenn Murray
committed
Mar 4, 2014
1 parent
64a0196
commit 6f2cc6b
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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 | ||
}] | ||
}); | ||
console.log('done'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
/* | ||
* Test that bunyan process will terminate | ||
*/ | ||
|
||
var exec = require('child_process').exec; | ||
|
||
// node-tap API | ||
if (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(); | ||
}); | ||
}); |