- added file logging

git-svn-id: http://moon:8086/svn/projects/HendiControl@288 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2019-05-04 07:59:26 +00:00
parent 659c0c3073
commit ff38f08d7a
+4
View File
@@ -67,6 +67,7 @@ class Controller(TimerListener):
self.receipe_done = False
self.thread = threading.Thread(target=self.main)
self.thread.start()
self.fp_log = None
def command(self, cmd):
self.queue.put_nowait(cmd)
@@ -131,6 +132,7 @@ class Controller(TimerListener):
def log(self, s):
now = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
print("{}: {}".format(now, s))
self.fp_log.write("{}: {}\n".format(now, s))
def report(self):
self.log("Temp SOLL {} °C".format(self.ctrl_theta_soll))
@@ -177,6 +179,7 @@ class Controller(TimerListener):
elif msg == commands.RUN:
if not self.processTimer.isActive:
self.fp_log = open(self.receipe['Name'] + '.log', "w")
self.time = 0
self.rast_index = 0
self.reportTimer.start(self.report_interval)
@@ -206,6 +209,7 @@ class Controller(TimerListener):
# Stirrer and plant
self.stirrer.deactivate()
self.plant.activate(False)
self.fp_log.close()
self.receipe_sema.release()
def rast(self, rast):