Changeset 513 in tmcsimulator for trunk/src/python/unifiedlogger
- Timestamp:
- 11/07/2019 07:22:39 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/python/unifiedlogger/activitylog_watcher.py
r479 r513 26 26 logfilepath = config.get('Paths', 'ActivityLogPath') 27 27 logfilename = "data.json" #"IncidentActivity.log" 28 data_summary = "data_summary.json" 28 29 lines = [] 29 30 output = [] 30 31 try: 31 32 json_file = open (logfilepath + logfilename,'r') … … 34 35 else: 35 36 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, ", ""]) 36 47 json_file.close() 37 return json.loads(jsonData)['data']48 return output 38 49 39 50 def setup(): … … 51 62 # Format messages into desired result format 52 63 for item in currList: 64 # implement ticket #188 53 65 # extract desired fields 66 incident_num = item[0].split("-")[1] 67 # extract the incident number from the date time field 54 68 name = item[3].replace(',','') 55 69 code = item[4].replace(',','') 56 70 msg = item[5].replace(',','') 57 desiredFields = "Activity Log.,"+name+"," +code+" "+msg71 desiredFields = "Activity Log.,"+name+"," + incident_num + " " + code+" "+msg 58 72 # Append to results list 59 73 resultList.append(desiredFields)
Note: See TracChangeset
for help on using the changeset viewer.
