aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/logger.ts
blob: 8e9928b5795d53c42730985a64bad6840127fbaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if (typeof (window) !== "undefined") {
    window["SBLogs"] = {
        debug: [],
        warn: []
    };
}

export function logDebug(message: string) {
    if (typeof (window) !== "undefined") {
        window["SBLogs"].debug.push(`[${new Date().toISOString()}] ${message}`);
    } else {
        console.log(`[${new Date().toISOString()}] ${message}`)
    }
}

export function logWarn(message: string) {
    if (typeof (window) !== "undefined") {
        window["SBLogs"].warn.push(`[${new Date().toISOString()}] ${message}`);
    } else {
        console.warn(`[${new Date().toISOString()}] ${message}`)
    }
}