mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-30 17:42:06 -04:00
logger: add a dedicated QML logging Singleton
- adds log.info/error/debug/warn/fatal - adds ability to write logs to any file - add CLI options in addition to env to set log levels
This commit is contained in:
@@ -3,24 +3,25 @@ import qs.Services
|
||||
|
||||
Item {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("PluginGlobalVar")
|
||||
|
||||
required property string varName
|
||||
property var defaultValue: undefined
|
||||
|
||||
readonly property var value: {
|
||||
const pid = parent?.pluginId ?? ""
|
||||
const pid = parent?.pluginId ?? "";
|
||||
if (!pid || !PluginService.globalVars[pid]) {
|
||||
return defaultValue
|
||||
return defaultValue;
|
||||
}
|
||||
return PluginService.globalVars[pid][varName] ?? defaultValue
|
||||
return PluginService.globalVars[pid][varName] ?? defaultValue;
|
||||
}
|
||||
|
||||
function set(newValue) {
|
||||
const pid = parent?.pluginId ?? ""
|
||||
const pid = parent?.pluginId ?? "";
|
||||
if (pid) {
|
||||
PluginService.setGlobalVar(pid, varName, newValue)
|
||||
PluginService.setGlobalVar(pid, varName, newValue);
|
||||
} else {
|
||||
console.warn("PluginGlobalVar: Cannot set", varName, "- no pluginId from parent")
|
||||
log.warn("Cannot set", varName, "- no pluginId from parent");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user