fix log analyzer
This commit is contained in:
parent
4b7f1752ec
commit
73eb21e850
@ -22,26 +22,27 @@ def readfile() -> list:
|
||||
with open("log.txt", 'r') as inputFile:
|
||||
line = inputFile.readline()
|
||||
while line:
|
||||
line = inputFile.readline()
|
||||
try:
|
||||
linedict = json.loads(line)
|
||||
lines.append(linedict)
|
||||
except json.JSONDecodeError:
|
||||
continue
|
||||
finally:
|
||||
line = inputFile.readline()
|
||||
return lines
|
||||
|
||||
|
||||
def readconfigdates() -> dict:
|
||||
dates = {}
|
||||
with open("dates.txt", 'r') as inputFile:
|
||||
line = inputFile.readline()
|
||||
line = inputFile.readline().rstrip()
|
||||
currline = 0
|
||||
while line:
|
||||
line = inputFile.readline()
|
||||
currline += 1
|
||||
dateformatted = datetime.datetime.strptime(
|
||||
line, '%Y-%m-%d %H:%M:%S')
|
||||
dates[currline] = dateformatted
|
||||
line = inputFile.readline().rstrip()
|
||||
currline += 1
|
||||
return dates
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user