Created
January 4, 2019 06:59
-
-
Save dongbum/c8785313d3336bf21c23d45fca0c28c7 to your computer and use it in GitHub Desktop.
Revisions
-
dongbum created this gist
Jan 4, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ # https://stackoverflow.com/a/53121178/8793092 def follow(thefile): while True: line = thefile.readline() if not line: time.sleep(0.1) continue yield line if __name__ == '__main__': logfile = open("run/foo/access-log","r") loglines = follow(logfile) for line in loglines: print(line, end='')