diff options
author | Maxim Devaev <[email protected]> | 2022-06-19 20:56:51 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-06-19 20:56:51 +0300 |
commit | 43da6af153107b0e1ed176dea08effdcb71725f6 (patch) | |
tree | 4a50e6cd1d6e38829bf50dfbb456c1846f5bbcaa /kvmd | |
parent | 0edf854832a85c68d09125a0ef1491a093c78d99 (diff) |
improved subprocess cmd logging
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/janus/runner.py | 2 | ||||
-rw-r--r-- | kvmd/apps/kvmd/info/hw.py | 5 | ||||
-rw-r--r-- | kvmd/apps/kvmd/streamer.py | 2 | ||||
-rw-r--r-- | kvmd/apps/otgnet/__init__.py | 2 | ||||
-rw-r--r-- | kvmd/plugins/ugpio/cmd.py | 3 |
5 files changed, 8 insertions, 6 deletions
diff --git a/kvmd/apps/janus/runner.py b/kvmd/apps/janus/runner.py index b62e47bd..a0110f47 100644 --- a/kvmd/apps/janus/runner.py +++ b/kvmd/apps/janus/runner.py @@ -175,7 +175,7 @@ class JanusRunner: # pylint: disable=too-many-instance-attributes for part in self.__cmd ] self.__janus_proc = await aioproc.run_process(cmd) - get_logger(0).info("Started Janus pid=%d: %s", self.__janus_proc.pid, cmd) + get_logger(0).info("Started Janus pid=%d: %s", self.__janus_proc.pid, tools.cmdfmt(cmd)) async def __kill_janus_proc(self) -> None: if self.__janus_proc: diff --git a/kvmd/apps/kvmd/info/hw.py b/kvmd/apps/kvmd/info/hw.py index aac21c15..a99fb09d 100644 --- a/kvmd/apps/kvmd/info/hw.py +++ b/kvmd/apps/kvmd/info/hw.py @@ -33,6 +33,7 @@ from typing import Optional from ....logging import get_logger from .... import env +from .... import tools from .... import aiofs from .... import aioproc @@ -137,10 +138,10 @@ class HwInfoSubmanager(BaseInfoSubmanager): try: text = (await aioproc.read_process(cmd, err_to_null=True))[1] except Exception: - get_logger(0).exception("Error while executing %s", cmd) + get_logger(0).exception("Error while executing: %s", tools.cmdfmt(cmd)) return None try: return parser(text) except Exception as err: - get_logger(0).error("Can't parse %s output: %r: %s", cmd, text, err) + get_logger(0).error("Can't parse [ %s ] output: %r: %s", tools.cmdfmt(cmd), text, tools.efmt(err)) return None diff --git a/kvmd/apps/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py index 357403ec..1e387240 100644 --- a/kvmd/apps/kvmd/streamer.py +++ b/kvmd/apps/kvmd/streamer.py @@ -453,7 +453,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes for part in self.__cmd ] self.__streamer_proc = await aioproc.run_process(cmd) - get_logger(0).info("Started streamer pid=%d: %s", self.__streamer_proc.pid, cmd) + get_logger(0).info("Started streamer pid=%d: %s", self.__streamer_proc.pid, tools.cmdfmt(cmd)) async def __kill_streamer_proc(self) -> None: if self.__streamer_proc: diff --git a/kvmd/apps/otgnet/__init__.py b/kvmd/apps/otgnet/__init__.py index 3f2d99b8..7a5e4cc7 100644 --- a/kvmd/apps/otgnet/__init__.py +++ b/kvmd/apps/otgnet/__init__.py @@ -131,7 +131,7 @@ class _Service: # pylint: disable=too-many-instance-attributes async def __run_ctl(self, ctl: BaseCtl, direct: bool) -> bool: logger = get_logger() cmd = ctl.get_command(direct) - logger.info("CMD: %s", " ".join(cmd)) + logger.info("CMD: %s", tools.cmdfmt(cmd)) try: return (not (await aioproc.log_process(cmd, logger)).returncode) except Exception as err: diff --git a/kvmd/plugins/ugpio/cmd.py b/kvmd/plugins/ugpio/cmd.py index 72f7ee8e..5233b76f 100644 --- a/kvmd/plugins/ugpio/cmd.py +++ b/kvmd/plugins/ugpio/cmd.py @@ -83,7 +83,8 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute if proc.returncode != 0: raise RuntimeError(f"Custom command error: retcode={proc.returncode}") except Exception as err: - get_logger(0).error("Can't run custom command %s: %s", self.__cmd, tools.efmt(err)) + get_logger(0).error("Can't run custom command [ %s ]: %s", + tools.cmdfmt(self.__cmd), tools.efmt(err)) raise GpioDriverOfflineError(self) def __str__(self) -> str: |