add support for multiple log-files
This commit is contained in:
parent
92518aed55
commit
b4456d9080
12
tsstats.py
12
tsstats.py
|
@ -1,5 +1,6 @@
|
|||
import re
|
||||
import sys
|
||||
import glob
|
||||
import json
|
||||
import configparser
|
||||
from os.path import exists
|
||||
|
@ -135,10 +136,13 @@ def check_client(clid, nick):
|
|||
clients[clid] = {}
|
||||
clients[clid]['nick'] = nick
|
||||
|
||||
|
||||
with open(log_path, 'r') as f:
|
||||
today = datetime.utcnow()
|
||||
for line in f:
|
||||
log_files = [file_name for file_name in glob.glob(log_path)]
|
||||
log_lines = []
|
||||
for log_file in log_files:
|
||||
for line in open(log_file, 'r'):
|
||||
log_lines.append(line)
|
||||
today = datetime.utcnow()
|
||||
for line in log_lines:
|
||||
parts = line.split('|')
|
||||
logdatetime = datetime.strptime(parts[0], '%Y-%m-%d %H:%M:%S.%f')
|
||||
sid = int(parts[3].strip())
|
||||
|
|
Loading…
Reference in New Issue