MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / create_log_callback

Method create_log_callback

src/web/task_manager.py:390–398  ·  view source on GitHub ↗

创建日志回调函数,可附加任务编号前缀,并同时推送到批量任务频道

(self, task_uuid: str, prefix: str = "", batch_id: str = "")

Source from the content-addressed store, hash-verified

388 logger.info(f"批量任务 WebSocket 连接已注销: {batch_id}")
389
390 def create_log_callback(self, task_uuid: str, prefix: str = "", batch_id: str = "") -> Callable[[str], None]:
391 """创建日志回调函数,可附加任务编号前缀,并同时推送到批量任务频道"""
392 def callback(msg: str):
393 full_msg = f"{prefix} {msg}" if prefix else msg
394 self.add_log(task_uuid, full_msg)
395 # 如果属于批量任务,同步推送到 batch 频道,前端可在混合日志中看到详细步骤
396 if batch_id:
397 self.add_batch_log(batch_id, full_msg)
398 return callback
399
400 def create_check_cancelled_callback(self, task_uuid: str) -> Callable[[], bool]:
401 """创建检查取消的回调函数"""

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected