I am looking to parse a log produced by an external program. This log is parsed into a list which is then served to a front-end application.
This questions covers how to continuously read a file; however, my application needs to be doing other things the time.sleep(1) period.
Ideally, I would be able to call a function, say parse_log(log_list), and have the results of the parsing be appended to log_list. Additionally, I should be able to clear log_list outside of the parser without breaking anything.
Bonus challenge: Functionality to pause and resume parsing.
Edit: Preferably cross-platform.
selectsystem call in Linux instead ofsleep) or perhaps inotify