Skip to content

Instantly share code, notes, and snippets.

@shonenada
Created April 18, 2016 16:34
Show Gist options
  • Save shonenada/c16eeb8d250e46a3c52ae7cdd879631a to your computer and use it in GitHub Desktop.
Save shonenada/c16eeb8d250e46a3c52ae7cdd879631a to your computer and use it in GitHub Desktop.
import sys
import time
def follow(filename):
log_file = open(filename, 'r')
log_file.seek(0, 2)
while True:
line = log_file.readline()
if not line:
time.sleep(0.1)
continue
yield line
print sys.argv[1]
for line in follow(sys.argv[1]):
print line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment