From c25ce3a5bd1e14a09859accb57bf6c645e26f8e6 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Fri, 20 Feb 2015 14:52:37 -0800 Subject: [PATCH] Allow `log.child(...)` to work even if the logger is a *sub-class* of Bunyan's Logger class. --- CHANGES.md | 2 ++ lib/bunyan.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 068e91a..0d20fc7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,8 @@ Known issues: ## 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 #218] Reset `haveNonRawStreams` on `.addStream`. diff --git a/lib/bunyan.js b/lib/bunyan.js index c74c108..4d2cdc8 100644 --- a/lib/bunyan.js +++ b/lib/bunyan.js @@ -608,7 +608,7 @@ Logger.prototype.addSerializers = function addSerializers(serializers) { * creation. See 'tools/timechild.js' for numbers. */ Logger.prototype.child = function (options, simple) { - return new Logger(this, options || {}, simple); + return new (this.constructor)(this, options || {}, simple); }