add support for multiple log-files

This commit is contained in:
Thor77 2015-06-02 15:13:08 +02:00
parent 92518aed55
commit b4456d9080
1 changed files with 35 additions and 31 deletions

View File

@ -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:
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 f:
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())