Fixes for common logger object

This commit is contained in:
Patrick McDonagh
2018-07-03 15:19:08 -05:00
parent 21cc94c919
commit 7c690affb5
5 changed files with 44 additions and 37 deletions

View File

@@ -8,11 +8,13 @@ from random import randint
from device_base import deviceBase
from channel import PLCChannel, read_tag, write_tag
from utilities import get_public_ip_address
from logger import filelogger
from file_logger import filelogger as log
_ = None
filelogger.info("multisensor startup")
# log = file_logger.setup()
log.info("multisensor startup")
# GLOBAL VARIABLES
WAIT_FOR_CONNECTION_SECONDS = 60
@@ -84,7 +86,7 @@ class start(threading.Thread, deviceBase):
for i in range(0, WAIT_FOR_CONNECTION_SECONDS):
print("multisensor driver will start in {} seconds".format(WAIT_FOR_CONNECTION_SECONDS - i))
time.sleep(1)
filelogger.info("BOOM! Starting multisensor driver...")
log.info("BOOM! Starting multisensor driver...")
self._check_watchdog()
self._check_ip_address()
@@ -98,7 +100,7 @@ class start(threading.Thread, deviceBase):
while True:
now = time.time()
if self.force_send:
filelogger.warning("FORCE SEND: TRUE")
log.warning("FORCE SEND: TRUE")
for chan in CHANNELS:
val = chan.read()
@@ -109,7 +111,7 @@ class start(threading.Thread, deviceBase):
# print("multisensor driver still alive...")
if self.force_send:
if send_loops > 2:
filelogger.warning("Turning off force_send")
log.warning("Turning off force_send")
self.force_send = False
send_loops = 0
else: