Commit 65e1c61d by 柴鹏飞

解决log多次重复输出的问题

parent 2d2941aa
...@@ -9,6 +9,11 @@ from ydl_ai_recommender.src.utils import get_project_path ...@@ -9,6 +9,11 @@ from ydl_ai_recommender.src.utils import get_project_path
def create_logger(name, filename=None, is_rotating=False): def create_logger(name, filename=None, is_rotating=False):
logger = logging.getLogger(name) logger = logging.getLogger(name)
# 已创建同名logger后,无需再次新建
if logger.handlers:
return logger
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
# 创建handler的输出格式(formatter) # 创建handler的输出格式(formatter)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment