From 28217131501f489d251b803afc1d9187aa0719d1 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sun, 19 Jun 2016 21:37:00 +0200 Subject: [PATCH 01/19] redefine scope of tsstats.log.* in func-docs --- tsstats/log.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tsstats/log.py b/tsstats/log.py index 08570f6..e9a5ad0 100644 --- a/tsstats/log.py +++ b/tsstats/log.py @@ -25,6 +25,8 @@ def parse_logs(log_glob, ident_map=None, *args, **kwargs): ''' parse logs specified by globbing pattern `log_glob` + basic parsing is done here: extracting sid and splitting + :param log_glob: path to log-files (supports globbing) :param ident_map: :doc:`identmap` @@ -42,7 +44,9 @@ def parse_logs(log_glob, ident_map=None, *args, **kwargs): def parse_log(log_path, ident_map=None, clients=None, online_dc=True): ''' - parse log-file at `log_path` + extract details from log-files + + detailed parsing is done here: onlinetime, kicks, pkicks, bans, pbans :param log_path: path to log-file :param ident_map: :doc:`identmap` From bec02798717d6f225eda2992c9e8ae8392cdb841 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sun, 19 Jun 2016 21:44:23 +0200 Subject: [PATCH 02/19] rename tsstats.log.parse_log to tsstats.log._parse_details --- tsstats/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsstats/log.py b/tsstats/log.py index e9a5ad0..32c59a1 100644 --- a/tsstats/log.py +++ b/tsstats/log.py @@ -42,7 +42,7 @@ def parse_logs(log_glob, ident_map=None, *args, **kwargs): return clients -def parse_log(log_path, ident_map=None, clients=None, online_dc=True): +def _parse_details(log_path, ident_map=None, clients=None, online_dc=True): ''' extract details from log-files From ad7ff96b1b4143cb2bdc54c6417dff803013cd4d Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sun, 19 Jun 2016 22:10:35 +0200 Subject: [PATCH 03/19] add filename-checking to split logs by sid * if filename doesn't match, fallback to plain sorting * using re_log_filename to match --- tsstats/log.py | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/tsstats/log.py b/tsstats/log.py index 32c59a1..b357583 100644 --- a/tsstats/log.py +++ b/tsstats/log.py @@ -2,11 +2,15 @@ import logging import re +from collections import namedtuple from datetime import datetime from glob import glob +from os.path import basename from tsstats.client import Client, Clients +re_log_filename = re.compile(r'ts3server_(?P\d{4}-\d\d-\d\d)' + '__(?P