simple-review-server/src/utils/logger.ts

37 lines
851 B
TypeScript
Raw Normal View History

2024-08-17 01:39:16 -04:00
import chalk from "chalk";
export class Logger {
private _wrn: string;
private _err: string;
private _main: string;
constructor() {
this._wrn = chalk.yellow("[WARN] ");
this._err = chalk.red("[ERROR] ");
this._main = chalk.bold.gray("[Simple Review Server] ");
}
log(text: any, args?: any): void {
args
? console.log(this._main + text, args)
: console.log(this._main + text);
2024-08-17 01:39:16 -04:00
}
warn(text: any, args?: any): void {
args
? console.warn(this._wrn + this._main + text, args)
: console.warn(this._wrn + this._main + text);
2024-08-17 01:39:16 -04:00
}
error(text: any, args?: any): void {
args
? console.error(this._err + this._main + text, args)
: console.error(this._err + this._main + text);
2024-08-17 01:39:16 -04:00
}
}
export const emp = chalk.green;
export const wrn = chalk.yellow;
export const err = chalk.red;