Ignore:
Timestamp:
12/19/2019 08:12:21 AM (6 years ago)
Author:
jdalbey
Message:

extend_unifiedlogger.py Fixed defect - wasn't including time and incident fields.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/python/unifiedlogger/extend_unifiedlogger.py

    r544 r545  
    77 
    88# read in the incident script in XML format 
    9 tree = ET.parse(logfilepath + 'incident_script_test.xml') 
     9tree = ET.parse(logfilepath + 'incident_script.xml') 
    1010# root is TMC_SCRIPT tag  
    1111root = tree.getroot() 
     
    2828            # Add the time index field to entry string 
    2929            if info_type.tag == 'TIME_INDEX': 
    30                 entry_str +=  info_type.text + "," 
     30                entry_time =  info_type.text + "," 
    3131            # Get the incident number to entry string  
    3232            if info_type.tag == "INCIDENT": 
    3333                incident_num = info_type.attrib["LogNum"] 
    34                 entry_str += " CAD Log, Incident #" + incident_num 
     34                entry_incinum = " CAD Log, Incident #" + incident_num 
    3535            # Get the cad data info  
    3636            if info_type.tag == 'CAD_DATA': 
     
    4040                    if event.tag == 'CAD_INCIDENT_EVENT': 
    4141                        # set flag to check if DETAIL field exist 
    42                         detail = False 
     42                        detailFlag = False 
     43                        detailText = "" 
    4344                        for info in event: 
    4445                            # Add the incident detail to entry string  
    4546                            if info.tag == "DETAIL": 
    4647                                # 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: 
    5959                            entries += entry_str + "\n" 
    6060# write all the entries from incident_sript.xml to the output file  
Note: See TracChangeset for help on using the changeset viewer.