Add debugstdout flag/config-directive

to enable debug logging to stdout

Fix #15
This commit is contained in:
Thor77 2017-02-27 12:39:31 +01:00
parent 0033ce186f
commit 8f49c3e95d
2 changed files with 9 additions and 1 deletions

View File

@ -40,6 +40,10 @@ def cli():
'-d', '--debug',
help='debug mode', action='store_true'
)
parser.add_argument(
'-ds', '--debugstdout',
help='write debug output to stdout', action='store_true'
)
parser.add_argument(
'-nod', '--noonlinedc',
help='don\'t add connect until now to onlinetime',
@ -71,9 +75,12 @@ def main(configuration):
# setup logging
if configuration.getboolean('General', 'debug'):
logger.setLevel(logging.DEBUG)
if configuration.getboolean('General', 'debugstdout'):
stream_handler.setLevel(logging.DEBUG)
# attach handlers
logger.addHandler(file_handler)
logger.addHandler(stream_handler)
logger.addHandler(file_handler)
idmap = configuration.get('General', 'idmap')
if idmap:

View File

@ -13,6 +13,7 @@ logger = logging.getLogger('tsstats')
DEFAULT_CONFIG = {
'General': {
'debug': False,
'debugstdout': False,
'log': '',
'output': 'tsstats.html',
'idmap': '',