31 lines
815 B
TypeScript
31 lines
815 B
TypeScript
|
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);
|
||
|
}
|
||
|
|
||
|
warn(text: any, args?: any): void {
|
||
|
args ? console.warn(this._wrn + this._main + text, args) : console.warn(this._wrn + this._main + text);
|
||
|
}
|
||
|
|
||
|
error(text: any, args?: any): void {
|
||
|
args ? console.error(this._err + this._main + text, args) : console.error(this._err + this._main + text);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export const emp = chalk.green;
|
||
|
export const wrn = chalk.yellow;
|
||
|
export const err = chalk.red;
|