Skip to content

Commit dd1a754

Browse files
committed
Change LLM log mode from append to overwrite for each run in run_codedog.py
1 parent 5a854dd commit dd1a754

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

run_codedog.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,19 @@ async def evaluate_repository_code(
11881188
author_commits = normalized_author_commits
11891189
print(f"After normalization: Found commits from {len(author_commits)} unique authors in the repository")
11901190

1191+
# 确保logs目录存在
1192+
os.makedirs("logs", exist_ok=True)
1193+
1194+
# 清空LLM日志文件,使用写入模式创建新文件
1195+
with open("logs/LLM_interactions.log", "w", encoding="utf-8") as f:
1196+
f.write(f"# LLM Interactions Log\n")
1197+
f.write(f"# Repository: {repo_path}\n")
1198+
f.write(f"# Date Range: {start_date} to {end_date}\n")
1199+
f.write(f"# Started: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n")
1200+
1201+
logger.info("Initialized new LLM interaction log file")
1202+
print("Initialized new LLM interaction log file")
1203+
11911204
# Initialize evaluator
11921205
evaluator = DiffEvaluator(model)
11931206

@@ -2175,6 +2188,16 @@ def main():
21752188
)
21762189
logger.info("Starting CodeDog")
21772190

2191+
# 确保logs目录存在
2192+
os.makedirs("logs", exist_ok=True)
2193+
2194+
# 清空LLM日志文件,使用写入模式创建新文件
2195+
with open("logs/LLM_interactions.log", "w", encoding="utf-8") as f:
2196+
f.write(f"# LLM Interactions Log\n")
2197+
f.write(f"# Started: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n")
2198+
2199+
logger.info("Initialized new LLM interaction log file")
2200+
21782201
# Parse arguments
21792202
args = parse_args()
21802203
logger.info(f"Command: {args.command}")

0 commit comments

Comments
 (0)