Replace Writer abstract class with interface
This commit is contained in:
+4
-15
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user