[pytango] 44/483: better event info

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.

commit b1379ea0e0c979edd80af0b2b68a5429dc8df4dc
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Mon Oct 17 10:23:51 2011 +0000

    better event info
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@18094 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 PyTango/utils.py | 38 +++++++++++++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 7 deletions(-)

diff --git a/PyTango/utils.py b/PyTango/utils.py
index e00565e..de61c1c 100644
--- a/PyTango/utils.py
+++ b/PyTango/utils.py
@@ -825,17 +825,41 @@ class EventCallBack(object):
         try:
             self._push_event(evt)
         except Exception, e:
-            print >>self._fd, "Unexpected error in callback: %s" % str(e)
+            name = evt.attr_name
+            print >>self._fd, "Unexpected error in callback for %s: %s" % (str(evt), str(e))
     
     def _push_event(self, evt):
         """Internal usage only"""
         self._append(evt)
-        d = { "date" : evt.get_date().todatetime(),
-              "reception_date" : evt.reception_date.todatetime(),
-              "type" : evt.event.upper(),
-              "dev_name" : evt.device.dev_name().upper(),
-              "name" : evt.attr_name.split("/")[-1].upper(),
-              "value" : self._get_value(evt) }
+        import datetime
+        now = datetime.datetime.now()
+        try:
+            date = evt.get_date().todatetime()
+        except:
+            date = now
+        try:
+            reception_date = evt.reception_date.todatetime()
+        except:
+            reception_date = now
+        try:
+            evt_type = evt.event.upper()
+        except:
+            evt_type = "<UNKNOWN>"
+        try:
+            dev_name = evt.device.dev_name().upper()
+        except:
+            dev_name = "<UNKNOWN>"
+        try:
+            attr_name = evt.attr_name.split("/")[-1].upper()
+        except:
+            attr_name = "<UNKNOWN>"
+        try:
+            value = self._get_value(evt)
+        except Exception, e:
+            value = "Unexpected exception in getting event value: %s" % str(e)
+        d = { "date" : date, "reception_date" : reception_date,
+              "type" : evt_type, "dev_name" : dev_name, "name" : attr_name,
+              "value" : value }
         print >>self._fd, self._msg.format(**d)
 
     def _append(self, evt):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list