summaryrefslogtreecommitdiff
path: root/backend/decky_loader/plugin/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/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/plugin.py')
-rw-r--r--backend/decky_loader/plugin/plugin.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/backend/decky_loader/plugin/plugin.py b/backend/decky_loader/plugin/plugin.py
index 8648a5d6..bed92f34 100644
--- a/backend/decky_loader/plugin/plugin.py
+++ b/backend/decky_loader/plugin/plugin.py
@@ -81,6 +81,13 @@ class PluginWrapper:
def __str__(self) -> str:
return self.name
+ 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
+
async def _response_listener(self):
while self._socket.active:
try:
@@ -92,7 +99,7 @@ class PluginWrapper:
elif res["type"] == SocketMessageType.RESPONSE.value:
self._method_call_requests.pop(res["id"]).set_result(res)
except CancelledError:
- self.log.info(f"Stopping response listener for {self.name}")
+ self.log.info(f"Stopping response listener for {self.get_display_name()}")
await self._socket.close_socket_connection()
# Cancel the request so that WSRouter can perform cleanup
@@ -107,7 +114,7 @@ class PluginWrapper:
async def execute_legacy_method(self, method_name: str, kwargs: Dict[Any, Any]):
if not self.legacy_method_warning:
self.legacy_method_warning = True
- self.log.warning(f"Plugin {self.name} is using legacy method calls. This will be removed in a future release.")
+ self.log.warning(f"Plugin {self.get_display_name()} is using legacy method calls. This will be removed in a future release.")
if self.passive:
raise RuntimeError("This plugin is passive (aka does not implement main.py)")
@@ -142,7 +149,7 @@ class PluginWrapper:
start_time = time()
if self.passive:
return
- self.log.info(f"Shutting down {self.name}")
+ self.log.info(f"Shutting down {self.get_display_name()}")
pending: set[Task[None]] | None = None;
@@ -162,16 +169,16 @@ class PluginWrapper:
for pending_task in pending:
pending_task.cancel()
- self.log.info(f"Plugin {self.name} has been stopped in {time() - start_time:.1f}s")
+ self.log.info(f"Plugin {self.get_display_name()} has been stopped in {time() - start_time:.1f}s")
except Exception as e:
- self.log.error(f"Error during shutdown for plugin {self.name}: {str(e)}\n{format_exc()}")
+ self.log.error(f"Error during shutdown for plugin {self.get_display_name()}: {str(e)}\n{format_exc()}")
async def kill_if_still_running(self):
start_time = time()
while self.proc and self.proc.is_alive():
elapsed_time = time() - start_time
if elapsed_time >= 5:
- self.log.warning(f"Plugin {self.name} still alive 5 seconds after stop request! Sending SIGKILL!")
+ self.log.warning(f"Plugin {self.get_display_name()} still alive 5 seconds after stop request! Sending SIGKILL!")
self.terminate(True)
await sleep(0.1)