Changeset 513 in tmcsimulator for trunk/src/python/unifiedlogger


Ignore:
Timestamp:
11/07/2019 07:22:39 PM (6 years ago)
Author:
jdalbey
Message:

activitylog_watcher.py Implement tickets #188, #192

File:
1 edited

Legend:

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

    r479 r513  
    2626    logfilepath = config.get('Paths', 'ActivityLogPath') 
    2727    logfilename = "data.json"   #"IncidentActivity.log" 
     28    data_summary = "data_summary.json" 
    2829    lines = [] 
    29      
     30    output = [] 
    3031    try: 
    3132        json_file = open (logfilepath + logfilename,'r') 
     
    3435    else: 
    3536        jsonData=json_file.read() 
     37        # implement ticket #192 
     38        output = json.loads(jsonData)['data']  
     39        # read in data_summary_json file 
     40        # assuming the data_summary.json is in the trunk foldera 
     41        data_summary = open(logfilepath + data_summary, 'r') 
     42        summary_json = data_summary.read() 
     43        data_lst = json.loads(summary_json)['data'] 
     44        for entry in data_lst: 
     45            # put the first 3 entries as place holder to be consistent with other type of logging 
     46            output.append([entry[0], entry[1] , entry[2], entry[3] , ", Incident Created, ", ""])  
    3647        json_file.close() 
    37     return json.loads(jsonData)['data']     
     48    return output 
    3849     
    3950def setup(): 
     
    5162    # Format messages into desired result format 
    5263    for item in currList: 
     64        # implement ticket #188 
    5365        # extract desired fields 
     66        incident_num = item[0].split("-")[1]  
     67        # extract the incident number from the date time field 
    5468        name = item[3].replace(',','') 
    5569        code = item[4].replace(',','') 
    5670        msg = item[5].replace(',','') 
    57         desiredFields = "Activity Log.,"+name+","+code+" "+msg 
     71        desiredFields = "Activity Log.,"+name+"," + incident_num + " " + code+" "+msg 
    5872        # Append to results list 
    5973        resultList.append(desiredFields) 
Note: See TracChangeset for help on using the changeset viewer.