Skip to content

Commit 5248809

Browse files
authored
chore(logger): extracted logger creation into protected method (#1646)
1 parent 24b0ca1 commit 5248809

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/logger/src/Logger.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class Logger extends Utility implements ClassThatLogs {
237237
logFormatter: this.getLogFormatter(),
238238
};
239239
const parentsPowertoolsLogData = this.getPowertoolLogData();
240-
const childLogger = new Logger(
240+
const childLogger = this.createLogger(
241241
merge(parentsOptions, parentsPowertoolsLogData, options)
242242
);
243243

@@ -554,6 +554,16 @@ class Logger extends Utility implements ClassThatLogs {
554554
this.processLogItem(16, input, extraInput);
555555
}
556556

557+
/**
558+
* Creates a new Logger instance.
559+
*
560+
* @param {ConstructorOptions} [options]
561+
* @returns {Logger}
562+
*/
563+
protected createLogger(options?: ConstructorOptions): Logger {
564+
return new Logger(options);
565+
}
566+
557567
/**
558568
* Decides whether the current log item should be printed or not.
559569
*

0 commit comments

Comments
 (0)