From: John Hodge Date: Mon, 5 Feb 2018 16:30:46 +0000 (+0800) Subject: VendServer - Log when a vend fails X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=416c876713175e18280d86a427b29d941611828e;p=uccvend-vendserver.git VendServer - Log when a vend fails --- diff --git a/VendServer/VendServer.py b/VendServer/VendServer.py index f977416..016c6d4 100755 --- a/VendServer/VendServer.py +++ b/VendServer/VendServer.py @@ -448,12 +448,13 @@ class VendServer(): exitcode = os.system('dispense -u "%s" snack:%s'%(self.vstatus.username, self.vstatus.cur_selection)) >> 8 if (exitcode == 0): # magic dispense syslog service - syslog.syslog(syslog.LOG_INFO | syslog.LOG_LOCAL4, "vended %s (slot %s) for %s" % (name, self.vstatus.cur_selection, self.vstatus.username)) (worked, code, string) = self.v.vend(self.vstatus.cur_selection) if worked: self.v.display('THANK YOU') + syslog.syslog(syslog.LOG_INFO | syslog.LOG_LOCAL4, "vended %s (slot %s) for %s" % (name, self.vstatus.cur_selection, self.vstatus.username)) else: print "Vend Failed:", code, string + syslog.syslog(syslog.LOG_WARNING | syslog.LOG_LOCAL4, "vending %s (slot %s) for %s FAILED %r %r" % (name, self.vstatus.cur_selection, self.vstatus.username, code, string)) self.v.display('VEND FAIL') elif (exitcode == 5): # RV_BALANCE self.v.display('NO MONEY?')