From 297e58efa5575326df20cabe36a6341e0fe697b7 Mon Sep 17 00:00:00 2001 From: kanshanxu <1085714254@qq.com> Date: Tue, 28 Jul 2026 07:37:08 +0800 Subject: [PATCH] feat: add show parameter to control LTtx console output - client.py: start() now accepts show=None to control log verbosity, default True preserves existing behavior - tx.py: remove show_force override in sys_print(), replace raw print() with sys_print() for unified control --- LTtx/tx/tx.py | 6 +++--- cfquant/client.py | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/LTtx/tx/tx.py b/LTtx/tx/tx.py index fff6d6f..a4fc179 100644 --- a/LTtx/tx/tx.py +++ b/LTtx/tx/tx.py @@ -231,7 +231,7 @@ def update_tx_version(self): def sys_print(self,data,show_force=False): msg = '%sLTtx[info]>>>>:%s,'%(self.get_nowtime(),data) - if self.sys_print_on or show_force: + if self.sys_print_on: print(msg) self.save_log(msg) @@ -1309,10 +1309,10 @@ def main_broadcast_heartbeat(self,client,who,pwd): self.sys_print(msg) break time.sleep(1) - print('退出心跳------') + self.sys_print('退出心跳------') if who in self.txg_dict and not self.txg_dict[who]['txg_running']: self.__connect_txg(who,pwd=pwd) - print('我全退出了') + self.sys_print('我全退出了') def create_channel(self,num=30): diff --git a/cfquant/client.py b/cfquant/client.py index 3c2f927..2f146f4 100644 --- a/cfquant/client.py +++ b/cfquant/client.py @@ -38,15 +38,18 @@ def __init__(self, host=None, port=None, token=None, request_channel=None, timeo self._callbacks = {} self._lock = threading.RLock() self._pending_lock = threading.RLock() + self._show = True self._started = False self._recv_thread = None - def start(self): + def start(self, show=None): with self._lock: if self._started: return + if show is not None: + self._show = show txl = self._load_txl() - self._tx = txl(self.host, self.port, self.token) + self._tx = txl(self.host, self.port, self.token, show=self._show) self._tx.start_tx() self._tx.start_txg(self.client_id) self._started = True