blob: be341ee91c52df7a211c808daa9e9252749e593d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
export default class Logger {
constructor(public name: string, public color: string) { }
private _log(level: "log" | "error" | "warn" | "info" | "debug", args: any[]) {
console[level](`%c ${this.name} `, `background: ${this.color}; color: black; font-weight: bold`, ...args);
}
public log(...args: any[]) {
this._log("log", args);
}
public info(...args: any[]) {
this._log("info", args);
}
public error(...args: any[]) {
this._log("error", args);
}
public warn(...args: any[]) {
this._log("warn", args);
}
public debug(...args: any[]) {
this._log("debug", args);
}
}
|