etherlab/runtime_etherlab.py
changeset 2116 2b1980a038b1
parent 2115 edb49073227e
child 2132 9f5e4dc43053
equal deleted inserted replaced
2115:edb49073227e 2116:2b1980a038b1
    77         log = s.value[:l-1]
    77         log = s.value[:l-1]
    78         if last :
    78         if last :
    79             log = log.rpartition(last)[2]
    79             log = log.rpartition(last)[2]
    80         if log : 
    80         if log : 
    81             last = log.rpartition('\n')[2]
    81             last = log.rpartition('\n')[2]
    82             for msg in re.findall(r'<\d>\[\s*\d*\.\d*\]\s*(EtherCAT\s*.*)$',
    82             for lvl,msg in re.findall(
    83                                   log, re.MULTILINE):
    83                             r'<(\d)>\[\s*\d*\.\d*\]\s*(EtherCAT\s*.*)$',
    84                 PLCObject.LogMessage(msg)
    84                             log, re.MULTILINE):
       
    85                 PLCObject.LogMessage(
       
    86                     LogLevelsDict[{
       
    87                         "4":"WARNING",
       
    88                         "3":"CRITICAL"}.get(lvl,"DEBUG")],
       
    89                     msg)
    85         time.sleep(0.5) 
    90         time.sleep(0.5) 
    86 
    91 
    87 def _runtime_etherlab_init():
    92 def _runtime_etherlab_init():
    88     global KMSGPollThread, StopKMSGThread
    93     global KMSGPollThread, StopKMSGThread
    89     StopKMSGThread = False
    94     StopKMSGThread = False