From 1cf6378ca0c207839793f6fee29a313c7c43bf87 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Sat, 13 Jul 2019 21:27:59 +0100 Subject: [PATCH] fix logging stuff --- src/CommunicationProcessor.py | 3 +++ src/RegisterDatapoint.py | 6 +++--- src/registers.pkl | Bin 1404 -> 2254 bytes 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/CommunicationProcessor.py b/src/CommunicationProcessor.py index f2a03dc..53a18b8 100644 --- a/src/CommunicationProcessor.py +++ b/src/CommunicationProcessor.py @@ -6,6 +6,7 @@ from pymodbus.client.sync import ModbusSerialClient import wiringpi import MyRS485 import time +import logging ERROR_PIN = 29 @@ -19,6 +20,8 @@ class CommunicationProcessor(threading.Thread): wiringpi.wiringPiSetup() wiringpi.pinMode(ERROR_PIN, wiringpi.OUTPUT) self.daemon = True + logging.getLogger('pymodbus').setLevel(logging.ERROR) + def __getSerial(self): # return RS485Ext.RS485Ext(port=self.config.serialPort, baudrate=self.config.serialBaudRate, stopbits=1, diff --git a/src/RegisterDatapoint.py b/src/RegisterDatapoint.py index 80450fe..96bf601 100644 --- a/src/RegisterDatapoint.py +++ b/src/RegisterDatapoint.py @@ -44,7 +44,6 @@ class HoldingRegisterDatapoint(AbstractModbusDatapoint): self.feedbackTopic = feedbackTopic self.writeRequestValue = None self.type = 'holding register' - self.logger = logging.getLogger('HoldingRegisterDatapoint') def __str__(self): return ("[{0!s}, publishTopic: {1}, subscribeTopic: {2}, feedbackTopic: {3}, " @@ -53,6 +52,7 @@ class HoldingRegisterDatapoint(AbstractModbusDatapoint): self.writeRequestValue)) def process(self, client, pubQueue): + self.logger = logging.getLogger('HoldingRegisterDatapoint') if self.writeRequestValue: # perform write operation self.logger.debug("Holding register, perform write operation") @@ -93,9 +93,9 @@ class InputRegisterDatapoint(ReadOnlyDatapoint): def __init__(self, label=None, unit=None, address=None, count=None, scanRate=None, updateOnly=None, publishTopic=None): super().__init__(label, unit, address, count, scanRate, updateOnly, publishTopic) self.type = 'input register' - self.logger = logging.getLogger('InputRegisterDatapoint') def process(self, client, pubQueue): + self.logger = logging.getLogger('InputRegisterDatapoint') # perform read operation self.logger.debug("Input register, perform read operation") self.processCount += 1 @@ -116,9 +116,9 @@ class DiscreteInputDatapoint(ReadOnlyDatapoint): def __init__(self, label=None, unit=None, address=None, count=None, scanRate=None, updateOnly=None, publishTopic=None): super().__init__(label, unit, address, count, scanRate, updateOnly, publishTopic) self.type = 'discrete input' - self.logger = logging.getLogger('DiscreteInputDatapoint') def process(self, client, pubQueue): + self.logger = logging.getLogger('DiscreteInputDatapoint') # perform read operation self.logger.debug("Discrete input, perform read operation") self.processCount += 1 diff --git a/src/registers.pkl b/src/registers.pkl index 21dd65dd3638e25a816a17bafee022b4943e89ae..7fd27429646843acf6055e932f1b776249077b21 100644 GIT binary patch literal 2254 zcmaKt+jHAQ6vmxfoybYkP)O1OC2hI5Kogn-S}x_55YjkNQ#DP*C6tx4@ruZjKUqp@ zK+poFG1qc`;XmMiVVL2C7iO4&86J4!kq3sOmF<|=t)J}Go^yWRr*GF+yVjA)ni|jB zrGWdhEMP^?b_3;{TMUENWptdlhRz6GS-m%vN)>(E^X;IF?p%kyj}{y+pXWY$%=nA# z=9NXcpkN=>r6cra^)zkUupOFKLf<+Rxlmv(iwiT2!lh(IK|fUvMA)CzyQ$Lmya0oZ zT^jwYk2pXZha%jT71Z{i$pSjlf+(;tiW+t42FiDi62UBGY%`2aHpz|&=N1$LBK85n@=XMG2bN{ za9347kW^^g^n7cMnStk*aknbv*T&*VE~P7t&a<`|;GPI$HM7eF&oaUij*8gLV-b!^ zsrQPE7!aiJzJ@Jo=r}b31^3hD2O?y%Qqg58;)EKT^q^Gbc;+S^Ql&i`o?l?3z{kU? zIFw6;1{1?OVnhsy(Q3RP4vV8Cf0!WKM+7HDT0Wk&OQz2QF1Iy;g>eZ#5#bRDf2s~Y z*)nIG=8V#udC#%P!Z@OoRDK?9kaQAnS5iW7g9i9pc5uTM|);GH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