Replace Writer abstract class with interface

This commit is contained in:
2024-05-15 21:04:28 +02:00
parent 208e7834d3
commit 69d93bcf61
+4 -15
View File
@@ -25,19 +25,8 @@ export type WriterOptions = {
[key: string | number | symbol]: any,
}
export abstract class Writer {
protected readonly _options: WriterOptions = {
minLevel: Level.INFO,
with_color: false,
}
public log(level: Level, ...data: any[]) : void {
if (level < this.options.minLevel) return
this.write(level, ...data)
}
protected abstract write(level: Level, ...data: any[]) : void;
public get options() : WriterOptions {
return this._options
}
export interface Writer {
log(level: Level, ...data: any[]) : void;
get options() : WriterOptions;
readonly _options: WriterOptions;
}