From 0cbaffd4b62eedfc8f58b827adb2cc8ffcaa9be4 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Thu, 25 May 2023 16:16:30 +0200 Subject: [PATCH] log.exception instead of log.error in callbacks + inhibit timestamps in future Change-Id: Idef463558bf24e891573179474ffbebd4e81468f --- frappy/client/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frappy/client/__init__.py b/frappy/client/__init__.py index 59fb20f..3f491ef 100644 --- a/frappy/client/__init__.py +++ b/frappy/client/__init__.py @@ -245,8 +245,10 @@ class ProxyClient: except UnregisterCallback: cblist.remove(cbfunc) except Exception as e: + # the programmer should catch all errors in callbacks + # if not, the log will be flooded with errors if self.log: - self.log.error('error %r calling %s%r', e, cbfunc.__name__, args) + self.log.exception('error %r calling %s%r', e, cbfunc.__name__, args) return bool(cblist) def updateValue(self, module, param, value, timestamp, readerror): @@ -398,6 +400,7 @@ class SecopClient(ProxyClient): value = data[0] readerror = None module, param = module_param + timestamp = min(time.time(), timestamp) # no timestamps in the future! try: self.updateValue(module, param, value, timestamp, readerror) except KeyError: