Use modern template
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import logger, {type Writer, Level, type WriterOptions} from 'log'
|
||||
|
||||
export * as log from 'log'
|
||||
export default logger
|
||||
|
||||
export class Console implements Writer {
|
||||
public constructor(
|
||||
readonly _options: WriterOptions
|
||||
) {}
|
||||
|
||||
private static get_logger(level: Level) : (...data: any[]) => void {
|
||||
switch (level) {
|
||||
case Level.DEBUG:
|
||||
case Level.TRACE: return console.debug
|
||||
case Level.INFO: return console.log
|
||||
case Level.WARNING: return console.warn
|
||||
case Level.ERROR: return console.error
|
||||
}
|
||||
}
|
||||
|
||||
log(level: Level, ...data: any[]): void {
|
||||
Console.get_logger(level)(...data)
|
||||
}
|
||||
|
||||
get options() : WriterOptions {
|
||||
return this._options;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user