diff --git a/v2/transmitter.py b/v2/transmitter.py index 99e86ae..430ca33 100644 --- a/v2/transmitter.py +++ b/v2/transmitter.py @@ -47,7 +47,7 @@ class Transmitter: # print(f'{ts} {os.getpid()} 获得锁') self.db_client.execute('set input_format_allow_errors_ratio=0.2') self.db_client.execute(sql) - print(f'写入耗时 {int(time.time() * 1000) - ts}') + self.log.info(f'写入耗时 {int(time.time() * 1000) - ts}') except Exception as e: # 丢弃错误行 再次发送 if hasattr(e, 'code') and e.code == 26: @@ -61,13 +61,14 @@ class Transmitter: self.__send(db, tb, data) else: # pass - traceback.print_exc() + msg = traceback.format_exc() + self.log.eror(msg) finally: pass # print(f' {os.getpid()} 释放锁') # self.lock.release() - print(f'{db}.{tb}插入{len(data)}条') + self.log.info(f'{db}.{tb}插入{len(data)}条') def check_table(self, db, tb, data): [self.sketch.alter_table(db, tb, item) for item in data]