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

Function log_message

internbootcamp/utils/tool_server/cli.py:310–317  ·  view source on GitHub ↗

记录日志消息到文件和控制台,并过滤base64图片数据

(message: str, log_path=None)

Source from the content-addressed store, hash-verified

308
309
310def log_message(message: str, log_path=None):
311 """记录日志消息到文件和控制台,并过滤base64图片数据"""
312 sanitized_message = sanitize_log_message(message)
313 log_line = f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] {sanitized_message}"
314 if log_path:
315 with open(log_path, 'a', encoding='utf-8') as f:
316 f.write(log_line + '\n')
317 print(log_line)
318
319
320def main():

Callers 1

mainFunction · 0.85

Calls 2

sanitize_log_messageFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected