From 42796be9d8d6228a1021e0962852c0dec252a992 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Tue, 22 Nov 2016 23:04:18 +0100 Subject: [PATCH] Use render_servers instead of render_template * limit to one output file for all virtual servers --- tsstats/__main__.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/tsstats/__main__.py b/tsstats/__main__.py index 74e4ea3..66ad78f 100644 --- a/tsstats/__main__.py +++ b/tsstats/__main__.py @@ -8,7 +8,7 @@ from os.path import abspath, exists from tsstats import config from tsstats.exceptions import InvalidConfiguration from tsstats.log import parse_logs -from tsstats.template import render_template +from tsstats.template import render_servers logger = logging.getLogger('tsstats') @@ -82,23 +82,18 @@ def main(configuration): if not log: raise InvalidConfiguration('log or output missing') - sid_clients = parse_logs( + servers = parse_logs( log, ident_map=identmap, online_dc=configuration.getboolean('General', 'onlinedc') ) - for sid, clients in sid_clients: - if sid and len(sid_clients) > 1: - ext = '.{}'.format(sid) - else: - ext = '' - render_template( - clients, - output=abspath(configuration.get('General', 'output') + ext), - template=configuration.get('General', 'template'), - datetime_fmt=configuration.get('General', 'datetimeformat'), - onlinetime_threshold=int(configuration.get( - 'General', 'onlinetimethreshold')) - ) + render_servers( + servers, + output=abspath(configuration.get('General', 'output')), + template=configuration.get('General', 'template'), + datetime_fmt=configuration.get('General', 'datetimeformat'), + onlinetime_threshold=int(configuration.get( + 'General', 'onlinetimethreshold')) + ) if __name__ == '__main__':