Changeset 433 in tmcsimulator for trunk/webapps/unifiedlogger/logging_service.py
- Timestamp:
- 07/07/2019 11:17:08 AM (7 years ago)
- File:
-
- 1 edited
-
trunk/webapps/unifiedlogger/logging_service.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/webapps/unifiedlogger/logging_service.py
r431 r433 1 import cms_watcher, time, json1 import cms_watcher, cad_watcher, time, json 2 2 # Unified Logging Service 3 3 # jdalbey 7/6/2019 … … 16 16 17 17 def main(): 18 # Delete any previously existing output file 19 f = open("../dynamicdata/unifiedlog.html", "w") 20 startHTML = "<HTML><HEAD><meta http-equiv=\"refresh\" content=\"5\" /></HEAD><BODY><PRE>" 21 f.write(startHTML); 22 f.close() 18 23 # List of the available plugin modules 19 plugins = ["cms_watcher" ]24 plugins = ["cms_watcher","cad_watcher"] 20 25 #FOR each plugin LOOP 21 26 for plugin in plugins: 22 27 # dynamically load the setup function for this plugin 23 plugmodule = locals()[plugin]28 plugmodule = globals()[plugin] 24 29 setupfunc = getattr(plugmodule, 'setup') 25 30 #Call setup … … 33 38 # Reset Output Buffer 34 39 output = "" 40 results = [] 35 41 # FOR each plugin LOOP 36 42 for plugin in plugins: 37 43 # dynamically load the setup function for this plugin 38 plugmodule = locals()[plugin]39 comparefunc = getattr(plugmodule, 'compare')44 plugmodule = globals()[plugin] 45 getfunc = getattr(plugmodule, 'getLogEntries') 40 46 41 47 # Run the plugin process returning new log entries 42 results = comparefunc() # Look for changed messages 48 results = getfunc() 49 # Append simulation time and the log entries to the Output Buffer 50 for item in results: 51 trimmed_item = item.strip() 52 if len(trimmed_item) > 0: 53 output += timeStamp + " " + trimmed_item + "\n" 43 54 # END LOOP 44 # Append simulation time and the log entries to the Output Buffer45 for item in results:46 output += timeStamp + " " + item + "\n"47 55 # IF the Output Buffer has any contents THEN 48 56 if len(output) > 0: 49 57 # Write (append) Output Buffer to unified log file 50 print output 58 print output, 59 f = open("../dynamicdata/unifiedlog.html", "a") 60 f.write(output) 61 f.close() 51 62 # END IF 52 63 # Wait one second
Note: See TracChangeset
for help on using the changeset viewer.
