""" 项目配置模块 提供统一的项目路径和配置管理 """ from pathlib import Path # 项目根目录(app/config/ 的上两级) PROJECT_ROOT = Path(__file__).parent.parent.parent # 日志目录 LOG_DIR = PROJECT_ROOT / "logs" # 配置文件目录 CONFIG_DIR = PROJECT_ROOT / "app" / "config" # DBN 配置目录 DBN_CONFIG_DIR = CONFIG_DIR / "dbn" def get_logger(name: str = "algorithm"): """ 获取日志记录器。主进程用 loguru,QGIS 子进程回退到标准 logging。 """ try: from app.utils.logger import get_logger as _get_logger return _get_logger(name, str(LOG_DIR)) except ImportError: import logging logging.basicConfig( level=logging.INFO, format="%(asctime)s [%(threadName)s] %(levelname)-5s %(name)s - %(message)s", ) return logging.getLogger(name)