From 11fd4a5dcc657db8ce9c836fc69f955eaac3b451 Mon Sep 17 00:00:00 2001 From: fishisnow Date: Wed, 12 Jun 2024 19:27:01 +0800 Subject: [PATCH] Fix: fix load_yaml logging, Avoid setting the log level to warning (#5019) Co-authored-by: huangyusong --- api/core/tools/utils/yaml_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/core/tools/utils/yaml_utils.py b/api/core/tools/utils/yaml_utils.py index 22e4d3d12..3526647b4 100644 --- a/api/core/tools/utils/yaml_utils.py +++ b/api/core/tools/utils/yaml_utils.py @@ -4,6 +4,7 @@ import os import yaml from yaml import YAMLError +logger = logging.getLogger(__name__) def load_yaml_file(file_path: str, ignore_error: bool = False) -> dict: """ @@ -24,11 +25,11 @@ def load_yaml_file(file_path: str, ignore_error: bool = False) -> dict: except Exception as e: raise YAMLError(f'Failed to load YAML file {file_path}: {e}') except FileNotFoundError as e: - logging.debug(f'Failed to load YAML file {file_path}: {e}') + logger.debug(f'Failed to load YAML file {file_path}: {e}') return {} except Exception as e: if ignore_error: - logging.warning(f'Failed to load YAML file {file_path}: {e}') + logger.warning(f'Failed to load YAML file {file_path}: {e}') return {} else: raise e