From fa1e927f4f4229b62468281cfcd6dc9195da2d6b Mon Sep 17 00:00:00 2001 From: Ryan May Date: Thu, 18 Nov 2021 12:13:47 -0700 Subject: [PATCH] MNT: Improve some logging calls Don't unconditionally do the string interpolation, but rather let logging do it if it's enabled. --- src/siphon/metadata.py | 3 +-- src/siphon/ncss_dataset.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/siphon/metadata.py b/src/siphon/metadata.py index 0c0636d2b..43563297f 100644 --- a/src/siphon/metadata.py +++ b/src/siphon/metadata.py @@ -511,8 +511,7 @@ def _get_handler(self, handler_name): elif handler_name in self._sts: return getattr(self._st, handler_name) else: - msg = f'cannot find handler for element {handler_name}' - log.warning(msg) + log.warning('cannot find handler for element %s', handler_name) def _parse_element(self, element): diff --git a/src/siphon/ncss_dataset.py b/src/siphon/ncss_dataset.py index 2d39bc859..65a74bbc4 100644 --- a/src/siphon/ncss_dataset.py +++ b/src/siphon/ncss_dataset.py @@ -200,8 +200,7 @@ def lookup(self, handler_name): if handler_name in dir(self): return getattr(self, handler_name) else: - msg = f'cannot find handler for element {handler_name}' - log.warning(msg) + log.warning('cannot find handler for element %s', handler_name) class NCSSDataset: