Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-tools.git;a=commitdiff;h=ac324384c893467fc4c5e8057b62dc07a6e52ac8

commit ac324384c893467fc4c5e8057b62dc07a6e52ac8
Author: James Buren <[email protected]>
Date:   Tue Oct 9 15:08:43 2012 -0500

log exceptions like in syncpkgcd.py

diff --git a/syncpkgd/syncpkgd.py b/syncpkgd/syncpkgd.py
index 3a2a8c9..440ddc4 100644
--- a/syncpkgd/syncpkgd.py
+++ b/syncpkgd/syncpkgd.py
@@ -25,6 +25,14 @@ class Actions:
self.logsock.write("%s\n" % "; ".join([time.ctime(), user, pkg, action]))
self.logsock.flush()

+       def log_exception(self):
+               type, value, tb = sys.exc_info()
+               stype = str(type).split("'")[1]
+               self.__log("server", "", "Traceback (most recent call last):")
+               self.__log("server", "", 
"".join(traceback.format_tb(tb)).strip())
+               self.__log("server", "", "%s: %s" % (stype, value))
+               self.save()
+
def __login(self, login, password):
if login in config.passes.keys() and \
hashlib.sha1(password).hexdigest() == config.passes[login]:
@@ -239,8 +247,7 @@ class Syncpkgd:
actions.save()
return
except Exception, ex:
-                       actions.__log("server","","unhandled exception in main 
loop: %s" % ex)
-                       actions.save()
+                       actions.log_exception()
return

def setuid(self):
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to