From d7bd1f0ccd549fa62f5a39469fddcc8d65de7ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Fale=C5=A1n=C3=ADk?= Date: Tue, 1 Oct 2019 16:37:55 +0200 Subject: [PATCH] Reduce log noise with read() * Change default NotImplementedError in read() for DoNotReadThisWidget * Turn up the notification about not reading the widget in logs from INFO to WARNING --- src/widgetastic/log.py | 4 ++-- src/widgetastic/widget/base.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widgetastic/log.py b/src/widgetastic/log.py index a81a7db7..31b853ad 100644 --- a/src/widgetastic/log.py +++ b/src/widgetastic/log.py @@ -115,8 +115,8 @@ def wrapped(self, *args, **kwargs): result = f(self, *args, **kwargs) except DoNotReadThisWidget: elapsed_time = (time.time() - start_time) * 1000.0 - self.logger.info( - '%s not read on widget\'s request (elapsed %.0f ms)', + self.logger.warning( + '%s - not read on widget\'s request (elapsed %.0f ms)', signature, elapsed_time) raise except Exception as e: diff --git a/src/widgetastic/widget/base.py b/src/widgetastic/widget/base.py index 2c0ddcca..d054b5a8 100644 --- a/src/widgetastic/widget/base.py +++ b/src/widgetastic/widget/base.py @@ -545,8 +545,8 @@ def read(self, *args, **kwargs): When you implement this method, the exact return value is up to you but it *MUST* be consistent with what :py:meth:`fill` takes. """ - raise NotImplementedError( - 'Widget {} does not implement read()!'.format(type(self).__name__)) + raise DoNotReadThisWidget( + 'Widget {} does not implement read()'.format(type(self).__name__)) def _process_fill_handler(self, handler): """Processes a given handler in the way that it is usable as a callable + its representation