log-mess
Version:
Log messages with tags and configuration
36 lines • 1.12 kB
JavaScript
import { store } from "./persistent.js";
let tagDisabled;
let tagEnabled;
let variableDisabled;
export function isLog(tag, silent) {
if (!tag)
return true;
if (getTagDisabled(tag))
return false;
if (getTagEnabled(tag))
return true;
if (store.config.value.t0.includes(tag))
return false;
if (store.config.value.t1.includes(tag))
return true;
return !silent;
}
export function isVariable() {
return !(getVariableDisabled() || 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