aboutsummaryrefslogtreecommitdiff
path: root/src/utils/logger.ts
blob: 0dda4bb8c288661fa2fe25f893372d2cde46b0f6 (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
28
29
30
31
32
33
export default class Logger {
    constructor(public name: string, public color: string) { }

    private _log(level: "log" | "error" | "warn" | "info" | "debug", levelColor: string, args: any[]) {
        console[level](
            `%c Vencord %c %c ${this.name} `,
            `background: ${levelColor}; color: black; font-weight: bold; border-radius: 5px;`,
            "",
            `background: ${this.color}; color: black; font-weight: bold; border-radius: 5px;`
            , ...args
        );
    }

    public log(...args: any[]) {
        this._log("log", "#a6d189", args);
    }

    public info(...args: any[]) {
        this._log("info", "#a6d189", args);
    }

    public error(...args: any[]) {
        this._log("error", "#e78284", args);
    }

    public warn(...args: any[]) {
        this._log("warn", "#e5c890", args);
    }

    public debug(...args: any[]) {
        this._log("debug", "#eebebe", args);
    }
}