add debug_file option and set debug-default to false

This commit is contained in:
Thor77 2015-06-22 16:38:42 +02:00
parent 624462d443
commit acecd17df2
1 changed files with 3 additions and 3 deletions

View File

@ -129,15 +129,15 @@ if not ('logfile' in general or 'outputfile' in general):
raise Exception('Invalid config! "logfile" and/or "outputfile" missing!') raise Exception('Invalid config! "logfile" and/or "outputfile" missing!')
log_path = general['logfile'] log_path = general['logfile']
output_path = general['outputfile'] output_path = general['outputfile']
debug = general.get('debug', 'true') in ['true', 'True'] debug = general.get('debug', 'false') in ['true', 'True']
debug_file = general.get('debugfile', str(debug)) in ['true', 'True']
title = html.get('title', 'TeamspeakStats') title = html.get('title', 'TeamspeakStats')
# setup logging # setup logging
log = logging.getLogger() log = logging.getLogger()
log.setLevel(logging.DEBUG)
# create handler # create handler
if debug: if debug and debug_file:
file_handler = logging.FileHandler('debug.txt', 'w', 'UTF-8') file_handler = logging.FileHandler('debug.txt', 'w', 'UTF-8')
file_handler.setFormatter(logging.Formatter('%(message)s')) file_handler.setFormatter(logging.Formatter('%(message)s'))
file_handler.setLevel(logging.DEBUG) file_handler.setLevel(logging.DEBUG)