first commit

This commit is contained in:
闫旭隆
2025-09-24 09:29:12 +08:00
parent 6339cdebb9
commit 2308536f66
360 changed files with 136381 additions and 0 deletions

19
atlas_rag/logging.py Normal file
View File

@ -0,0 +1,19 @@
import logging
from logging import Logger
from logging.handlers import RotatingFileHandler
import os
import datetime
from atlas_rag.evaluation.benchmark import BenchMarkConfig
def setup_logger(config:BenchMarkConfig, logger_name = "MyLogger") -> Logger:
date_time = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
log_file_path = f'./log/{config.dataset_name}_event{config.include_events}_concept{config.include_concept}_{date_time}.log'
logger = logging.getLogger(logger_name)
logger.setLevel(logging.INFO)
max_bytes = 50 * 1024 * 1024
if not os.path.exists(log_file_path):
os.makedirs(os.path.dirname(log_file_path), exist_ok=True)
handler = RotatingFileHandler(log_file_path, maxBytes=max_bytes, backupCount=5)
logger.addHandler(handler)
return logger