From ff38f08d7a63bca8f7f443405f9df507975e0630 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sat, 4 May 2019 07:59:26 +0000 Subject: [PATCH] - added file logging git-svn-id: http://moon:8086/svn/projects/HendiControl@288 fda53097-d464-4ada-af97-ba876c37ca34 --- Control/brewpi/controller.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Control/brewpi/controller.py b/Control/brewpi/controller.py index 31ff17c..84f34bb 100644 --- a/Control/brewpi/controller.py +++ b/Control/brewpi/controller.py @@ -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):