nep框架搭建

This commit is contained in:
2025-12-08 17:14:27 +08:00
parent 7a6ca92ad4
commit 0b6537a810
21 changed files with 219 additions and 1 deletions

View File

33
nep_auto/utils/logger.py Normal file
View File

@@ -0,0 +1,33 @@
import logging
import os
import sys
def setup_logger(log_file="logs/runtime.log"):
# 确保日志目录存在
os.makedirs(os.path.dirname(log_file), exist_ok=True)
logger = logging.getLogger("NEP_Auto")
logger.setLevel(logging.INFO)
# 避免重复添加 handler
if logger.handlers:
return logger
# 格式
formatter = logging.Formatter(
'[%(asctime)s] [%(levelname)s] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
# 文件输出
fh = logging.FileHandler(log_file, mode='a', encoding='utf-8')
fh.setFormatter(formatter)
logger.addHandler(fh)
# 屏幕输出
ch = logging.StreamHandler(sys.stdout)
ch.setFormatter(formatter)
logger.addHandler(ch)
return logger

View File

0
nep_auto/utils/runner.py Normal file
View File