tests/logging/py_ext_0@py_ext/py_ext.xml
changeset 1648 6431f26aa501
parent 1518 a656ccb868d4
child 1649 3291024e00da
equal deleted inserted replaced
1518:a656ccb868d4 1648:6431f26aa501
     1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
       
     2 <Python xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="py_ext_xsd.xsd">
       
     3 <![CDATA[import threading, time
       
     4 
       
     5 MyT = None
       
     6 Stop = False
       
     7 
       
     8 def StartLog():
       
     9     global MyT
       
    10     MyT=threading.Thread(target = DoLog)
       
    11     MyT.start()
       
    12 
       
    13 def DoLog():
       
    14     global Stop
       
    15     while not Stop:
       
    16         PLCObject.LogMessage("Python side Logging (PLC is %s)"%PLCObject.PLCStatus)
       
    17         time.sleep(0.3)
       
    18 
       
    19 def StopLog():
       
    20     global MyT,Stop
       
    21     Stop=True
       
    22 
       
    23 _runtime_init.append(StartLog)
       
    24 _runtime_cleanup.append(StopLog)
       
    25 ]]>
       
    26 </Python>