fix for handling some not dis/connect lines
This commit is contained in:
parent
28ded1fc9b
commit
32e060daa4
14
tsstats.py
14
tsstats.py
|
@ -160,6 +160,14 @@ for log_file in log_files:
|
||||||
for line in open(log_file, 'r'):
|
for line in open(log_file, 'r'):
|
||||||
log_lines.append(line)
|
log_lines.append(line)
|
||||||
|
|
||||||
|
|
||||||
|
def get_client(clid):
|
||||||
|
if clid in id_map:
|
||||||
|
clid = id_map[clid]
|
||||||
|
client = clients[clid]
|
||||||
|
client.nick = nick
|
||||||
|
return client
|
||||||
|
|
||||||
# process lines
|
# process lines
|
||||||
for line in log_lines:
|
for line in log_lines:
|
||||||
parts = line.split('|')
|
parts = line.split('|')
|
||||||
|
@ -167,13 +175,11 @@ for line in log_lines:
|
||||||
data = '|'.join(parts[4:]).strip()
|
data = '|'.join(parts[4:]).strip()
|
||||||
if data.startswith('client'):
|
if data.startswith('client'):
|
||||||
nick, clid = re_dis_connect.findall(data)[0]
|
nick, clid = re_dis_connect.findall(data)[0]
|
||||||
if clid in id_map:
|
|
||||||
clid = id_map[clid]
|
|
||||||
client = clients[clid]
|
|
||||||
client.nick = nick
|
|
||||||
if data.startswith('client connected'):
|
if data.startswith('client connected'):
|
||||||
|
client = get_client(clid)
|
||||||
client.connect(logdatetime)
|
client.connect(logdatetime)
|
||||||
elif data.startswith('client disconnected'):
|
elif data.startswith('client disconnected'):
|
||||||
|
client = get_client(clid)
|
||||||
client.disconnect(logdatetime)
|
client.disconnect(logdatetime)
|
||||||
if 'invokeruid' in data:
|
if 'invokeruid' in data:
|
||||||
re_disconnect_data = re_disconnect_invoker.findall(data)
|
re_disconnect_data = re_disconnect_invoker.findall(data)
|
||||||
|
|
Loading…
Reference in New Issue