const l = {debug: 0, info: 1, warn: 2, error: 3};
let n = {enabled: !0, level: "warn"};

async function g() {
    try {
        const e = await chrome.storage.local.get("loggerConfig");
        e.loggerConfig && (n = {...n, ...e.loggerConfig})
    } catch {
    }
}

g();

function t(e) {
    const r = o => n.enabled ? l[o] >= l[n.level] : !1;
    return {
        debug: (...o) => {
            r("debug") && console.log(`[${e}]`, ...o)
        }, info: (...o) => {
            r("info") && console.log(`[${e}]`, ...o)
        }, warn: (...o) => {
            r("warn") && console.warn(`[${e}]`, ...o)
        }, error: (...o) => {
            r("error") && console.error(`[${e}]`, ...o)
        }
    }
}

export {t as c};
