add some logs

This commit is contained in:
fdev31 2023-07-29 16:13:17 +02:00
parent 9d0dc6df79
commit dd335574d9
2 changed files with 8 additions and 1 deletions

View file

@ -61,4 +61,5 @@ def get_logger(name="pypr", level=None):
logger.propagate = False
for handler in LogObjects.handlers:
logger.addHandler(handler)
logger.debug(f"Logger initialized for {name}")
return logger

View file

@ -110,6 +110,9 @@ class Scratch:
assert isinstance(clientInfo, dict)
self.clientInfo.update(clientInfo)
def __str__(self):
return f"{self.uid} {self.address} : {self.clientInfo} / {self.conf}"
class Extension(Plugin):
async def init(self) -> None:
@ -125,7 +128,7 @@ class Extension(Plugin):
async def die_in_piece(scratch: Scratch):
proc = self.procs[scratch.uid]
proc.terminate()
for n in range(10):
for _ in range(10):
if not scratch.isAlive():
break
await asyncio.sleep(0.1)
@ -243,6 +246,7 @@ class Extension(Plugin):
if not item.visible and not force:
self.log.warn(f"{uid} is already hidden")
return
self.log.info(f"Hiding {uid}")
item.visible = False
addr = "address:0x" + item.address
animation_type: str = item.conf.get("animation", "").lower()
@ -294,6 +298,8 @@ class Extension(Plugin):
self.log.warn(f"{uid} is already visible")
return
self.log.info(f"Showing {uid}")
if not item.isAlive():
self.log.info(f"{uid} is not running, restarting...")
if uid in self.procs: