Skip to content
Snippets Groups Projects
Commit fbfc1a17 authored by Robin Mueller's avatar Robin Mueller
Browse files

loggers implemented

parent 5f90b5c0
No related branches found
No related tags found
No related merge requests found
from multiprocessing.connection import Listener from multiprocessing.connection import Listener
from multiprocessing import Process from multiprocessing import Process
from utility.obsw_logger import get_logger
import logging import logging
LOGGER = get_logger()
class TmTcBackend(Process): class TmTcBackend(Process):
def __init__(self): def __init__(self):
from obsw_tmtc_client import TmTcHandler from obsw_tmtc_client import TmTcHandler
...@@ -17,13 +20,13 @@ class TmTcBackend(Process): ...@@ -17,13 +20,13 @@ class TmTcBackend(Process):
def listen(self): def listen(self):
self.conn = self.listener.accept() self.conn = self.listener.accept()
print('connection accepted from' + str(self.listener.last_accepted)) LOGGER.info("TmTcBackend: Connection accepted from %s",str(self.listener.last_accepted))
while True: while True:
msg = self.conn.recv() msg = self.conn.recv()
# do something with msg # do something with msg
# here, the core client could be called to perform operations based on received message # here, the core client could be called to perform operations based on received message
if msg == 'test': if msg == 'test':
print("Hallo Welt !") LOGGER.info("TmTcBackend: Hallo Welt !")
elif msg == 'close': elif msg == 'close':
try: try:
self.conn.close() self.conn.close()
......
...@@ -45,6 +45,7 @@ class TmTcGUI(Process): ...@@ -45,6 +45,7 @@ class TmTcGUI(Process):
self.root = tk.Tk() self.root = tk.Tk()
self.root.title("Hallo Welt") self.root.title("Hallo Welt")
while True: while True:
LOGGER.info("TmTcGUI: Sending test message")
self.conn.send("test") self.conn.send("test")
self.root.update() self.root.update()
time.sleep(0.1) time.sleep(0.1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment