added some header data to the output file

master
Nicholas Hope 2023-01-04 22:54:08 -05:00
parent 1d886763f7
commit 34ebb313b9
1 changed files with 5 additions and 3 deletions

View File

@ -114,13 +114,14 @@ def analyze_server(server: Path) -> None:
# convert from its default timezone in GMT to the timezone of the requester
localtime = time_of_hit.replace(tzinfo=timezone.utc).astimezone(timezone)
# convert this time back to a string for logging purposes, without timezone
localtime_str = ' '.join(localtime.strftime(log_date_format).split(' ')[:2])
localdate, localtime = localtime.strftime(log_date_format).split(' ')[:2]
localdate = '20' + localdate
distance = latlon_distance(self_latlon, latlon)
date, time = timethings.split(' ')[:2]
result += (
f'{server.name},{ip},{distance:.5f},{date},{time},'
+ f'{localtime_str},{method},"{file}"\n'
f'{server.name},{ip},{distance:.5f},20{date},{time},'
+ f'{localdate},{localtime},{method},"{file}"\n'
)
return result
@ -153,6 +154,7 @@ def main(args: list) -> int:
logdir = p.resolve()
with open(outfile, 'w') as f:
f.write('server,ip,distance,sv date,sv time,local date,local time,verb,filename\n')
chdir(logdir)
serverdir = Path('.')
for subdir in serverdir.iterdir():