- better logging of drivers

git-svn-id: http://moon:8086/svn/projects/HendiControl@363 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2020-04-19 16:05:53 +00:00
parent b51e2c222d
commit 95afea668f
6 changed files with 48 additions and 22 deletions
+7 -3
View File
@@ -1,8 +1,12 @@
import time
import abc
import logging
class AStirrer(abc.ABC):
@abc.abstractmethod
def name(self):
return ""
def __init__(self, dt):
self.dt = dt
self.speed = 0
@@ -12,8 +16,8 @@ class AStirrer(abc.ABC):
self.isOn = 1
def log(self, s):
now = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
print("{}: {}".format(now, s))
d = {'user': self.name()}
logging.info ("{}".format(s), extra=d)
def process(self):
isOn = self.isOn