From d1627d369f965f2ceb3312a4ae143ccb8d3d3740 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sun, 18 Sep 2016 21:51:24 +0200 Subject: [PATCH] Add debug-logging-output to tsstats.template.render_template * bump version to 0.11.1 --- setup.py | 2 +- tsstats/template.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index af33de2..985edb7 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( name='tsstats', - version='0.11.0', + version='0.11.1', author='Thor77', author_email='thor77@thor77.org', description='A simple Teamspeak stats-generator', diff --git a/tsstats/template.py b/tsstats/template.py index 9700dfa..2c42ccb 100644 --- a/tsstats/template.py +++ b/tsstats/template.py @@ -57,10 +57,14 @@ def render_template(clients, output, title='TeamspeakStats', def frmttime(timestamp): if not timestamp: return '' - return timestamp.strftime(datetime_fmt) + formatted = timestamp.strftime(datetime_fmt) + logger.debug('Formatting timestamp %s -> %s', timestamp, formatted) + return formatted template_env.filters['frmttime'] = frmttime template = template_env.get_template(template_path) + logger.debug('Rendering template %s', template) with open(output, 'w') as f: f.write(template.render(title=title, objs=objs, debug=logger.level <= logging.DEBUG, creation_time=datetime.now())) + logger.debug('Wrote rendered template to %s', output)