Skip to content

Commit a476523

Browse files
committed
fix: allow duplicate child keys
Throwing an error when making a duplicate child was a pretty major API change. Previously it returned the existing child. This change was causing a whole lot of errors downstream. [ci skip]
1 parent 63199f4 commit a476523

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/Logger.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class Logger {
1111
public readonly keys: string;
1212
public readonly handlers: Set<Handler>;
1313
public readonly parent?: Logger;
14-
public readonly loggers: Set<string> = new Set();
1514

1615
constructor(
1716
key: string = 'root',
@@ -27,12 +26,7 @@ class Logger {
2726
}
2827

2928
public getChild(key: string): Logger {
30-
if (this.loggers.has(key)) {
31-
throw Error('cannot have duplicate child keys');
32-
}
33-
const logger = new Logger(key, LogLevel.NOTSET, [], this);
34-
this.loggers.add(key);
35-
return logger;
29+
return new Logger(key, LogLevel.NOTSET, [], this);
3630
}
3731

3832
public getParent(): Logger | undefined {

0 commit comments

Comments
 (0)