36 lines
838 B
Python
36 lines
838 B
Python
from extensions.rt_service import rt_service as rts
|
|
import logging
|
|
import threading
|
|
import time
|
|
|
|
|
|
|
|
|
|
def thread_function(name):
|
|
|
|
logging.info("MonThread %s: starting", name)
|
|
rtserv = rts.RT_Service()
|
|
isok = rtserv.openDataChannel('/dev/mon-datafile')
|
|
if (not isok):
|
|
logging.info("MonThread %s: could not open the logport", name)
|
|
|
|
while (isok):
|
|
msg = rtserv.readDataChannel()
|
|
logging.info(msg)
|
|
if (msg == 'noResult'):
|
|
break
|
|
|
|
logging.info("MonThread %s: finishing", name)
|
|
rtserv.closeDataChannel()
|
|
|
|
|
|
|
|
def createCoproLoggingTask():
|
|
format = "%(asctime)s: %(message)s"
|
|
logging.basicConfig(format=format, level=logging.INFO, datefmt="%H:%M:%S")
|
|
x = threading.Thread(target=thread_function, args=(1,))
|
|
|
|
x.start()
|
|
return x
|
|
|