with open logfile for Python autohandling of closure.

This commit is contained in:
Dan Schaper 2016-10-02 11:31:12 -07:00
parent 14424939a9
commit 64b91c8b97

View file

@ -154,15 +154,16 @@ with conn:
create_tables()
# Parse the log file.
for line in open(logfile):
line = line.rstrip()
with open(logfile) as f:
for line in f:
line = line.rstrip()
if ': query[' in line:
parse_query(line)
if ': query[' in line:
parse_query(line)
elif ': forwarded ' in line:
parse_forward(line)
elif ': forwarded ' in line:
parse_forward(line)
elif (': reply ' in line) or (': cached ' in line):
parse_reply(line)
elif (': reply ' in line) or (': cached ' in line):
parse_reply(line)