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:
|
with open("log.txt", 'r') as inputFile:
|
||||||
line = inputFile.readline()
|
line = inputFile.readline()
|
||||||
while line:
|
while line:
|
||||||
line = inputFile.readline()
|
|
||||||
try:
|
try:
|
||||||
linedict = json.loads(line)
|
linedict = json.loads(line)
|
||||||
lines.append(linedict)
|
lines.append(linedict)
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
continue
|
continue
|
||||||
|
finally:
|
||||||
|
line = inputFile.readline()
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
|
||||||
def readconfigdates() -> dict:
|
def readconfigdates() -> dict:
|
||||||
dates = {}
|
dates = {}
|
||||||
with open("dates.txt", 'r') as inputFile:
|
with open("dates.txt", 'r') as inputFile:
|
||||||
line = inputFile.readline()
|
line = inputFile.readline().rstrip()
|
||||||
currline = 0
|
currline = 0
|
||||||
while line:
|
while line:
|
||||||
line = inputFile.readline()
|
|
||||||
currline += 1
|
|
||||||
dateformatted = datetime.datetime.strptime(
|
dateformatted = datetime.datetime.strptime(
|
||||||
line, '%Y-%m-%d %H:%M:%S')
|
line, '%Y-%m-%d %H:%M:%S')
|
||||||
dates[currline] = dateformatted
|
dates[currline] = dateformatted
|
||||||
|
line = inputFile.readline().rstrip()
|
||||||
|
currline += 1
|
||||||
return dates
|
return dates
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user