Skip to content

Commit 0b6235b

Browse files
committed
tmux_cmd(fix[logging]): Fix logging convention violations
why: f-string in logger.exception and .format() in post-exec log defeat lazy formatting; shlex.join(cmd) was computed twice redundantly. what: - Compute shlex.join(cmd) once into cmd_str variable - Replace f-string in logger.exception with lazy formatting + extra - Replace .format() post-exec log with lazy formatting + structured extra - Guard post-exec debug log with logger.isEnabledFor(logging.DEBUG)
1 parent be2ed09 commit 0b6235b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/libtmux/common.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,11 @@ def __init__(self, *args: t.Any, tmux_bin: str | None = None) -> None:
260260

261261
self.cmd = cmd
262262

263+
cmd_str = shlex.join(cmd)
263264
logger.debug(
264265
"running %s",
265-
shlex.join(cmd),
266-
extra={"tmux_cmd": shlex.join(cmd)},
266+
cmd_str,
267+
extra={"tmux_cmd": cmd_str},
267268
)
268269

269270
try:

0 commit comments

Comments
 (0)