From 0c7f9d06a632f793d7528ce9b5036b97ce53bd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 17 Jul 2024 18:18:44 -0600 Subject: [PATCH] Small refactor --- singer_sdk/metrics.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/singer_sdk/metrics.py b/singer_sdk/metrics.py index 3c4b09c6c..2f38c6f04 100644 --- a/singer_sdk/metrics.py +++ b/singer_sdk/metrics.py @@ -394,7 +394,7 @@ def _load_yaml_logging_config(path: Traversable | Path) -> t.Any: # noqa: ANN40 return yaml.safe_load(f) -def _get_default_config() -> t.Any: # noqa: ANN401 +def _get_default_config_path() -> Traversable: """Get a logging configuration. Returns: @@ -403,10 +403,11 @@ def _get_default_config() -> t.Any: # noqa: ANN401 filename = "default_logging.yml" path = get_package_files(__package__) / filename if path.is_file(): - return _load_yaml_logging_config(path) + return path - path = get_package_files("singer_sdk").joinpath("default_logging.yml") - return _load_yaml_logging_config(path) + return get_package_files("singer_sdk").joinpath( # pragma: no cover + "default_logging.yml" + ) def _setup_logging(config: t.Mapping[str, t.Any]) -> None: @@ -415,7 +416,7 @@ def _setup_logging(config: t.Mapping[str, t.Any]) -> None: Args: config: A plugin configuration dictionary. """ - logging.config.dictConfig(_get_default_config()) + logging.config.dictConfig(_load_yaml_logging_config(_get_default_config_path())) config = config or {} metrics_log_level = config.get(METRICS_LOG_LEVEL_SETTING, "INFO").upper()