Files
log/src/writer/index.ts
T
2024-05-14 12:46:32 +02:00

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
}
}