MCPcopy Create free account
hub / github.com/InternLM/InternBootcamp / TeeOutput

Class TeeOutput

internbootcamp/utils/tool_server/cli.py:120–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118
119 # 重定向到该日志文件,同时输出到控制台
120 class TeeOutput:
121 def __init__(self, *files):
122 self.files = files
123
124 def write(self, data):
125 if data:
126 data = sanitize_log_message(data)
127 for f in self.files:
128 f.write(data)
129 f.flush()
130
131 def flush(self):
132 for f in self.files:
133 f.flush()
134
135 log_file_obj = open(temp_log_file, 'a', buffering=1) # 行缓冲
136 sys.stdout = TeeOutput(sys.__stdout__, log_file_obj)

Callers 1

start_worker_processFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected