some logging rework
This commit is contained in:
parent
6d4834989e
commit
9c15ce42e2
2 changed files with 3 additions and 8 deletions
|
@ -65,9 +65,9 @@ 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):
|
||||
self.log.debug("%s.%s%s", plugin.name, full_name, params)
|
||||
try:
|
||||
await getattr(plugin, full_name)(*params)
|
||||
except Exception as e: # pylint: disable=W0718
|
||||
|
@ -75,10 +75,6 @@ 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"
|
||||
|
|
|
@ -21,7 +21,7 @@ async def get_event_stream():
|
|||
|
||||
async def hyprctlJSON(command) -> list[dict[str, Any]] | dict[str, Any]:
|
||||
"""Run an IPC command and return the JSON output."""
|
||||
log.debug("JS>> %s", command)
|
||||
log.debug(command)
|
||||
try:
|
||||
ctl_reader, ctl_writer = await asyncio.open_unix_connection(HYPRCTL)
|
||||
except FileNotFoundError as e:
|
||||
|
@ -48,7 +48,7 @@ def _format_command(command_list, default_base_command):
|
|||
|
||||
async def hyprctl(command, base_command="dispatch") -> bool:
|
||||
"""Run an IPC command. Returns success value."""
|
||||
log.debug("JS>> %s", command)
|
||||
log.debug(command)
|
||||
try:
|
||||
ctl_reader, ctl_writer = await asyncio.open_unix_connection(HYPRCTL)
|
||||
except FileNotFoundError as e:
|
||||
|
@ -65,7 +65,6 @@ async def hyprctl(command, base_command="dispatch") -> bool:
|
|||
resp = await ctl_reader.read(100)
|
||||
ctl_writer.close()
|
||||
await ctl_writer.wait_closed()
|
||||
log.debug("<<JS %s", resp)
|
||||
r: bool = resp == b"ok" * (len(resp) // 2)
|
||||
if not r:
|
||||
log.error("FAILED %s", resp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue