Skip to content

Commit d6114a6

Browse files
authored
Avoid setLevel in child when possible (#2271)
Signed-off-by: Matteo Collina <[email protected]>
1 parent 260f07e commit d6114a6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/proto.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,10 @@ function child (bindings, options) {
147147
}
148148

149149
instance[chindingsSym] = asChindings(instance, bindings)
150-
const childLevel = options.level || this.level
151-
instance[setLevelSym](childLevel)
150+
if ((options.level !== undefined && options.level !== this.level) || options.hasOwnProperty('customLevels')) {
151+
const childLevel = options.level || this.level
152+
instance[setLevelSym](childLevel)
153+
}
152154
this.onChild(instance)
153155
return instance
154156
}

0 commit comments

Comments
 (0)