summaryrefslogtreecommitdiff
path: root/backend/decky_loader/plugin/sandboxed_plugin.py
diff options
context:
space:
mode:
authorynhhoJ <22500212+ynhhoJ@users.noreply.github.com>2026-07-14 05:23:49 +0300
committerGitHub <noreply@github.com>2026-07-13 22:23:49 -0400
commit671cfe49caad5f4b7f209ee8a596cda8a1c7b4a7 (patch)
tree208121e962e543ad3b8277be4f9824dfb9124c28 /backend/decky_loader/plugin/sandboxed_plugin.py
parentdfaeb0beb3c441cd42adc432d560fd450af87c14 (diff)
downloaddecky-loader-671cfe49caad5f4b7f209ee8a596cda8a1c7b4a7.tar.gz
decky-loader-671cfe49caad5f4b7f209ee8a596cda8a1c7b4a7.zip
feat: Add plugins version in logs (#871)
Diffstat (limited to 'backend/decky_loader/plugin/sandboxed_plugin.py')
-rw-r--r--backend/decky_loader/plugin/sandboxed_plugin.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/backend/decky_loader/plugin/sandboxed_plugin.py b/backend/decky_loader/plugin/sandboxed_plugin.py
index 20da747e..675eb464 100644
--- a/backend/decky_loader/plugin/sandboxed_plugin.py
+++ b/backend/decky_loader/plugin/sandboxed_plugin.py
@@ -45,6 +45,13 @@ class SandboxedPlugin:
self.log = getLogger("sandboxed_plugin")
+ def get_display_name(self) -> str:
+ """Returns plugin name with version if available, formatted for logging."""
+ if self.version:
+ return f"{self.name} (v{self.version})"
+
+ return self.name
+
def initialize(self, socket: LocalSocket):
self._socket = socket
@@ -125,51 +132,51 @@ class SandboxedPlugin:
get_event_loop().create_task(self.Plugin._main(self.Plugin))
get_event_loop().create_task(socket.setup_server(self.on_new_message))
except:
- self.log.error("Failed to start " + self.name + "!\n" + format_exc())
+ self.log.error(f"Failed to start {self.get_display_name()}!\n{format_exc()}")
sys.exit(0)
try:
get_event_loop().run_forever()
except SystemExit:
pass
except:
- self.log.error("Loop exited for " + self.name + "!\n" + format_exc())
+ self.log.error(f"Loop exited for {self.get_display_name()}!\n{format_exc()}")
finally:
get_event_loop().close()
async def _unload(self):
try:
- self.log.info("Attempting to unload with plugin " + self.name + "'s \"_unload\" function.\n")
+ self.log.info(f"Attempting to unload with plugin {self.get_display_name()}'s \"_unload\" function.\n")
if hasattr(self.Plugin, "_unload"):
if self.api_version > 0:
await self.Plugin._unload()
else:
await self.Plugin._unload(self.Plugin)
- self.log.info("Unloaded " + self.name + "\n")
+ self.log.info(f"Unloaded {self.get_display_name()}\n")
else:
- self.log.info("Could not find \"_unload\" in " + self.name + "'s main.py" + "\n")
+ self.log.info(f"Could not find \"_unload\" in {self.get_display_name()}'s main.py\n")
except:
- self.log.error("Failed to unload " + self.name + "!\n" + format_exc())
+ self.log.error(f"Failed to unload {self.get_display_name()}!\n{format_exc()}")
pass
async def _uninstall(self):
try:
- self.log.info("Attempting to uninstall with plugin " + self.name + "'s \"_uninstall\" function.\n")
+ self.log.info(f"Attempting to uninstall with plugin {self.get_display_name()}'s \"_uninstall\" function.\n")
if hasattr(self.Plugin, "_uninstall"):
if self.api_version > 0:
await self.Plugin._uninstall()
else:
await self.Plugin._uninstall(self.Plugin)
- self.log.info("Uninstalled " + self.name + "\n")
+ self.log.info(f"Uninstalled {self.get_display_name()}\n")
else:
- self.log.info("Could not find \"_uninstall\" in " + self.name + "'s main.py" + "\n")
+ self.log.info(f"Could not find \"_uninstall\" in {self.get_display_name()}'s main.py\n")
except:
- self.log.error("Failed to uninstall " + self.name + "!\n" + format_exc())
+ self.log.error(f"Failed to uninstall {self.get_display_name()}!\n{format_exc()}")
pass
async def shutdown(self):
if not self.shutdown_running:
self.shutdown_running = True
- self.log.info(f"Calling Loader unload function for {self.name}.")
+ self.log.info(f"Calling Loader unload function for {self.get_display_name()}.")
await self._unload()
if self.uninstalling: