Better logs

This commit is contained in:
Dan 2018-06-14 03:26:08 +02:00
parent 463ef828c2
commit 68133e8be5

View File

@ -209,8 +209,7 @@ class Session:
self.start() self.start()
async def net_worker(self): async def net_worker(self):
name = threading.current_thread().name log.info("NetWorkerTask started")
log.debug("{} started".format(name))
while True: while True:
packet = await self.recv_queue.get() packet = await self.recv_queue.get()
@ -277,10 +276,10 @@ class Session:
except Exception as e: except Exception as e:
log.error(e, exc_info=True) log.error(e, exc_info=True)
log.debug("{} stopped".format(name)) log.info("NetWorkerTask stopped")
async def ping(self): async def ping(self):
log.debug("Ping Task started") log.info("PingTask started")
while True: while True:
try: try:
@ -298,10 +297,10 @@ class Session:
except (OSError, TimeoutError, Error): except (OSError, TimeoutError, Error):
pass pass
log.debug("Ping Task stopped") log.info("PingTask stopped")
async def next_salt(self): async def next_salt(self):
log.debug("NextSaltThread started") log.info("NextSaltTask started")
while True: while True:
now = datetime.now() now = datetime.now()
@ -331,10 +330,10 @@ class Session:
self.connection.close() self.connection.close()
break break
log.debug("NextSaltThread stopped") log.info("NextSaltTask stopped")
async def recv(self): async def recv(self):
log.debug("Recv Task started") log.info("RecvTask started")
while True: while True:
packet = await self.connection.recv() packet = await self.connection.recv()
@ -350,7 +349,7 @@ class Session:
self.recv_queue.put_nowait(packet) self.recv_queue.put_nowait(packet)
log.debug("Recv Task stopped") log.info("RecvTask stopped")
async def _send(self, data: Object, wait_response: bool = True): async def _send(self, data: Object, wait_response: bool = True):
message = self.msg_factory(data) message = self.msg_factory(data)