|
@@ -473,13 +473,12 @@ class ToTextBotAgent:
|
|
|
return None
|
|
|
|
|
|
class CustomLogWriter(pj.LogWriter):
|
|
|
+ def __init__(self, logger):
|
|
|
+ self.logger = logger
|
|
|
|
|
|
def write(self, msg):
|
|
|
- # 在这里自定义日志输出
|
|
|
print(f"Custom Log: {msg}") # 输出到控制台
|
|
|
- # 也可以将日志写入文件
|
|
|
- with open("pjsua_logs.txt", "a") as f:
|
|
|
- f.write(msg + "\n")
|
|
|
+ self.logger.info(msg)
|
|
|
|
|
|
@singleton_keys
|
|
|
class BotAgent:
|
|
@@ -505,6 +504,7 @@ class BotAgent:
|
|
|
ep_cfg.medConfig.noVad = True
|
|
|
ep_cfg.logConfig.level = 4
|
|
|
ep_cfg.logConfig.consoleLevel = 4
|
|
|
+ ep_cfg.logConfig.writer = CustomLogWriter(self.logger)
|
|
|
self.ep.libCreate()
|
|
|
self.ep.libInit(ep_cfg)
|
|
|
|