Add debugstdout flag/config-directive
to enable debug logging to stdout Fix #15
This commit is contained in:
parent
0033ce186f
commit
8f49c3e95d
|
@ -40,6 +40,10 @@ def cli():
|
||||||
'-d', '--debug',
|
'-d', '--debug',
|
||||||
help='debug mode', action='store_true'
|
help='debug mode', action='store_true'
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'-ds', '--debugstdout',
|
||||||
|
help='write debug output to stdout', action='store_true'
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-nod', '--noonlinedc',
|
'-nod', '--noonlinedc',
|
||||||
help='don\'t add connect until now to onlinetime',
|
help='don\'t add connect until now to onlinetime',
|
||||||
|
@ -71,9 +75,12 @@ def main(configuration):
|
||||||
# setup logging
|
# setup logging
|
||||||
if configuration.getboolean('General', 'debug'):
|
if configuration.getboolean('General', 'debug'):
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
if configuration.getboolean('General', 'debugstdout'):
|
||||||
|
stream_handler.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
# attach handlers
|
# attach handlers
|
||||||
logger.addHandler(file_handler)
|
|
||||||
logger.addHandler(stream_handler)
|
logger.addHandler(stream_handler)
|
||||||
|
logger.addHandler(file_handler)
|
||||||
|
|
||||||
idmap = configuration.get('General', 'idmap')
|
idmap = configuration.get('General', 'idmap')
|
||||||
if idmap:
|
if idmap:
|
||||||
|
|
|
@ -13,6 +13,7 @@ logger = logging.getLogger('tsstats')
|
||||||
DEFAULT_CONFIG = {
|
DEFAULT_CONFIG = {
|
||||||
'General': {
|
'General': {
|
||||||
'debug': False,
|
'debug': False,
|
||||||
|
'debugstdout': False,
|
||||||
'log': '',
|
'log': '',
|
||||||
'output': 'tsstats.html',
|
'output': 'tsstats.html',
|
||||||
'idmap': '',
|
'idmap': '',
|
||||||
|
|
Loading…
Reference in New Issue