Allow log.child(...) to work even if the logger is a *sub-class* of Bunyan's Logger class.

This commit is contained in:
Trent Mick 2015-02-20 14:52:37 -08:00
parent a7c646191d
commit c25ce3a5bd
2 changed files with 3 additions and 1 deletions

View file

@ -8,6 +8,8 @@ Known issues:
## bunyan 1.3.4 (not yet released) ## bunyan 1.3.4 (not yet released)
- Allow `log.child(...)` to work even if the logger is a *sub-class*
of Bunyan's Logger class.
- [issue #219] Hide 'source-map-support' require from browserify. - [issue #219] Hide 'source-map-support' require from browserify.
- [issue #218] Reset `haveNonRawStreams` on `<logger>.addStream`. - [issue #218] Reset `haveNonRawStreams` on `<logger>.addStream`.

View file

@ -608,7 +608,7 @@ Logger.prototype.addSerializers = function addSerializers(serializers) {
* creation. See 'tools/timechild.js' for numbers. * creation. See 'tools/timechild.js' for numbers.
*/ */
Logger.prototype.child = function (options, simple) { Logger.prototype.child = function (options, simple) {
return new Logger(this, options || {}, simple); return new (this.constructor)(this, options || {}, simple);
} }