QGIS修改日志报错

This commit is contained in:
wzy-warehouse
2026-06-20 17:07:05 +08:00
parent ca14e931f8
commit 402102cf36
2 changed files with 33 additions and 33 deletions
+3 -13
View File
@@ -18,16 +18,6 @@ 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)
"""获取日志记录器(loguru 不可用时自动回退标准 logging)"""
from app.utils.logger import LoggerManager
return LoggerManager.get_logger(name, str(LOG_DIR))