mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 23:11:56 +00:00
Add python logging to browser and plugin
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# Full imports
|
||||
import json
|
||||
import pprint
|
||||
from pprint import pformat
|
||||
|
||||
# Partial imports
|
||||
from aiohttp import ClientSession, web
|
||||
@@ -110,9 +112,15 @@ class PluginBrowser:
|
||||
logger.info(" at dir " + self.find_plugin_folder(name))
|
||||
logger.debug("calling frontend unload for %s" % str(name))
|
||||
await tab.evaluate_js(f"DeckyPluginLoader.unloadPlugin('{name}')")
|
||||
plugins_snapshot = self.plugins.copy()
|
||||
snapshot_string = pformat(plugins_snapshot)
|
||||
logger.debug("current plugins: %s", snapshot_string)
|
||||
if self.plugins[name]:
|
||||
logger.debug("Plugin %s was found", name)
|
||||
self.plugins[name].stop()
|
||||
logger.debug("Plugin %s was stopped", name)
|
||||
del self.plugins[name]
|
||||
logger.debug("Plugin %s was removed from the dictionary", name)
|
||||
logger.debug("removing files %s" % str(name))
|
||||
rmtree(self.find_plugin_folder(name))
|
||||
except FileNotFoundError:
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ class PluginWrapper:
|
||||
|
||||
async def _unload(self):
|
||||
try:
|
||||
self.log.info("Attempting to unload with plugin " + self.name + "'s \"_unload function/\"" + "\n")
|
||||
self.log.info("Attempting to unload with plugin " + self.name + "'s \"_unload\" function.\n")
|
||||
if hasattr(self.Plugin, "_unload"):
|
||||
await self.Plugin._unload(self.Plugin)
|
||||
self.log.info("Unloaded " + self.name + "\n")
|
||||
|
||||
@@ -180,6 +180,7 @@ class PluginLoader extends Logger {
|
||||
}
|
||||
|
||||
public unloadPlugin(name: string) {
|
||||
console.log('Plugin List: ', this.plugins);
|
||||
const plugin = this.plugins.find((plugin) => plugin.name === name || plugin.name === name.replace('$LEGACY_', ''));
|
||||
plugin?.onDismount?.();
|
||||
this.plugins = this.plugins.filter((p) => p !== plugin);
|
||||
|
||||
Reference in New Issue
Block a user