VendServer - Log when a vend fails
authorJohn Hodge <[email protected]>
Mon, 5 Feb 2018 16:30:46 +0000 (00:30 +0800)
committerJohn Hodge <[email protected]>
Mon, 5 Feb 2018 16:30:46 +0000 (00:30 +0800)
VendServer/VendServer.py

index f977416..016c6d4 100755 (executable)
@@ -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?')

UCC git Repository :: git.ucc.asn.au