From 6d4834989e08a8a6af51a26975f0b22c875b85de Mon Sep 17 00:00:00 2001 From: fdev31 Date: Sun, 30 Jul 2023 00:40:37 +0200 Subject: [PATCH] only show handlers having listeners --- pyprland/command.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyprland/command.py b/pyprland/command.py index 621d259..22c6c85 100755 --- a/pyprland/command.py +++ b/pyprland/command.py @@ -64,6 +64,8 @@ class Pyprland: async def _callHandler(self, full_name, *params): "Call an event handler with params" + + have_listeners = False for plugin in [self] + list(self.plugins.values()): if hasattr(plugin, full_name): try: @@ -73,6 +75,10 @@ class Pyprland: "%s::%s(%s) failed:", plugin.name, full_name, params ) self.log.exception(e) + else: + have_listeners = True + if have_listeners: + self.log.debug("%s%s", full_name, params) async def read_events_loop(self): "Consumes the event loop and calls corresponding handlers" @@ -84,7 +90,6 @@ class Pyprland: cmd, params = data.split(">>") full_name = f"event_{cmd}" - self.log.debug("EVT %s(%s)", full_name, params.strip()) await self._callHandler(full_name, params) async def read_command(self, reader, writer) -> None: