22 lines
623 B
TypeScript
22 lines
623 B
TypeScript
export {Console} from 'writer/console'
|
|
export {File} from 'writer/file'
|
|
export {Counter} from 'writer/counter'
|
|
|
|
import {Level, type WriterOptions} from 'types'
|
|
|
|
export abstract class Writer {
|
|
protected readonly _options: WriterOptions;
|
|
protected constructor(options: WriterOptions) {
|
|
this._options = options
|
|
}
|
|
|
|
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
|
|
}
|
|
} |