Changeset 545 in tmcsimulator for trunk/src/python/unifiedlogger/extend_unifiedlogger.py
- Timestamp:
- 12/19/2019 08:12:21 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/python/unifiedlogger/extend_unifiedlogger.py
r544 r545 7 7 8 8 # read in the incident script in XML format 9 tree = ET.parse(logfilepath + 'incident_script _test.xml')9 tree = ET.parse(logfilepath + 'incident_script.xml') 10 10 # root is TMC_SCRIPT tag 11 11 root = tree.getroot() … … 28 28 # Add the time index field to entry string 29 29 if info_type.tag == 'TIME_INDEX': 30 entry_ str += info_type.text + ","30 entry_time = info_type.text + "," 31 31 # Get the incident number to entry string 32 32 if info_type.tag == "INCIDENT": 33 33 incident_num = info_type.attrib["LogNum"] 34 entry_ str += " CAD Log, Incident #" + incident_num34 entry_incinum = " CAD Log, Incident #" + incident_num 35 35 # Get the cad data info 36 36 if info_type.tag == 'CAD_DATA': … … 40 40 if event.tag == 'CAD_INCIDENT_EVENT': 41 41 # set flag to check if DETAIL field exist 42 detail = False 42 detailFlag = False 43 detailText = "" 43 44 for info in event: 44 45 # Add the incident detail to entry string 45 46 if info.tag == "DETAIL": 46 47 # replace commas with whitespace 47 text = info.text.replace(",", " ") 48 # if it's not the first DETAIL field, 49 # append to the end without "Detail" text 50 if detail: 51 entry_str += "; " + text 52 else: 53 entry_str += ", Detail: " + text 54 detail = True 55 56 # if there's detail field 57 # add it to the entries 58 if detail: 48 infotext = info.text.replace(",", " ") 49 # if it's the second DETAIL field, 50 # we don't need the "Detail" label 51 if not detailFlag: 52 detailText = ", Detail: " 53 detailFlag = True 54 detailText += infotext 55 # Build the complete line from the header and details 56 entry_str += entry_time + entry_incinum + detailText 57 # if there's detail field add it to the entries 58 if detailFlag: 59 59 entries += entry_str + "\n" 60 60 # write all the entries from incident_sript.xml to the output file
Note: See TracChangeset
for help on using the changeset viewer.
