log-mess
Version:
Log messages with tags and configuration
40 lines • 1.28 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.isLog = isLog;
exports.isVariable = isVariable;
const persistent_1 = require("./persistent.cjs");
let tagDisabled;
let tagEnabled;
let variableDisabled;
function isLog(tag, silent) {
if (!tag)
return true;
if (getTagDisabled(tag))
return false;
if (getTagEnabled(tag))
return true;
if (persistent_1.store.config.value.t0.includes(tag))
return false;
if (persistent_1.store.config.value.t1.includes(tag))
return true;
return !silent;
}
function isVariable() {
return !(getVariableDisabled() || persistent_1.store.config.value.v0);
}
function getVariableDisabled() {
if (variableDisabled === undefined)
variableDisabled = !!localStorage.getItem("log-mess-variable-disabled");
return variableDisabled;
}
function getTagDisabled(tag) {
if (tagDisabled === undefined)
tagDisabled = (localStorage.getItem("log-mess-disabled") || "").split(",");
return tagDisabled.includes(tag);
}
function getTagEnabled(tag) {
if (tagEnabled === undefined)
tagEnabled = (localStorage.getItem("log-mess-enabled") || "").split(",");
return tagEnabled.includes(tag);
}
//# sourceMappingURL=availability.js.map
;