Use mlzlog for better logging

Change-Id: Ic82ca0d7b43a906cb9c7d3f1350287e7082afc45
This commit is contained in:
Enrico Faulhaber
2017-05-16 18:15:56 +02:00
parent 780c6779f9
commit c0fd2e9907
9 changed files with 19 additions and 429 deletions

View File

@ -89,7 +89,9 @@ class ClientConsole(object):
import socket
import threading
from collections import deque
from secop import loggers
import mlzlog
from secop.protocol.encoding import ENCODERS
from secop.protocol.framing import FRAMERS
from secop.protocol.messages import *
@ -97,7 +99,7 @@ from secop.protocol.messages import *
class TCPConnection(object):
def __init__(self, connect, port, encoding, framing, **kwds):
self.log = loggers.log.getChild('connection', False)
self.log = mlzlog.log.getChild('connection', False)
self.encoder = ENCODERS[encoding]()
self.framer = FRAMERS[framing]()
self.connection = socket.create_connection((connect, port), 3)
@ -163,7 +165,7 @@ class TCPConnection(object):
class Client(object):
def __init__(self, opts):
self.log = loggers.log.getChild('client', True)
self.log = mlzlog.log.getChild('client', True)
self._cache = dict()
self.connection = TCPConnection(**opts)
self.connection.register_callback(self.handle_async)

View File

@ -28,7 +28,8 @@ from select import select
import threading
import Queue
from secop import loggers
import mlzlog
from secop.validators import validator_from_str
from secop.lib import mkthread
from secop.lib.parsing import parse_time, format_time
@ -150,7 +151,7 @@ class Client(object):
stopflag = False
def __init__(self, opts, autoconnect=True):
self.log = loggers.log.getChild('client', True)
self.log = mlzlog.log.getChild('client', True)
self._cache = dict()
if 'device' in opts:
# serial port