From 612055a088ffb46f8e0085bb8ab9d6efbc90debc Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sun, 19 Jun 2016 22:26:19 +0200 Subject: [PATCH] add wip tsstats.log.parse_logs --- tsstats/log.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tsstats/log.py b/tsstats/log.py index def8c18..23a9f3e 100644 --- a/tsstats/log.py +++ b/tsstats/log.py @@ -27,6 +27,20 @@ TimedLog = namedtuple('TimedLog', ['path', 'timestamp']) logger = logging.getLogger('tsstats') +def parse_logs(log_glob): + ''' + parse logs from `log_glob` + ''' + vserver_clients = {} + for virtualserver_id, logs in _sort_logfiles(log_glob): + clients = Clients() + for log in logs: + _parse_details(clients=clients) + if len(clients) >= 1: + vserver_clients[virtualserver_id] = clients + return vserver_clients + + def _sort_logfiles(log_glob): ''' collect logfiles from `log_glob` and sort them by date