From 416c876713175e18280d86a427b29d941611828e Mon Sep 17 00:00:00 2001 From: John Hodge Date: Tue, 6 Feb 2018 00:30:46 +0800 Subject: [PATCH] VendServer - Log when a vend fails --- VendServer/VendServer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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?') -- 2.20.1