Tighten up Verbose options

This commit is contained in:
Tim Van Baak 2020-12-28 15:58:07 -08:00
parent b3293fe87b
commit e0f4eec15a
1 changed files with 5 additions and 2 deletions

View File

@ -25,7 +25,7 @@ DEFAULT_LOG_FILE = None
# Whether logging is verbose # Whether logging is verbose
CONFIG_VERBOSE = 'Verbose' CONFIG_VERBOSE = 'Verbose'
DEFAULT_VERBOSITY = False DEFAULT_VERBOSITY = 'false'
def read_config_file(config_path): def read_config_file(config_path):
@ -88,7 +88,10 @@ log_file = configs.get(CONFIG_LOGFILE) or DEFAULT_LOG_FILE
if log_file and not os.path.isabs(log_file): if log_file and not os.path.isabs(log_file):
raise ValueError(f'Non-absolute log file path: {log_file}') raise ValueError(f'Non-absolute log file path: {log_file}')
is_verbose = (configs.get(CONFIG_VERBOSE) == 'true') or DEFAULT_VERBOSITY is_verbose = configs.get(CONFIG_VERBOSE) or DEFAULT_VERBOSITY
if is_verbose != 'true' and is_verbose != 'false':
raise ValueError(f'Invalid verbose value (must be "true" or "false"): {is_verbose}')
is_verbose = (is_verbose == 'true')
# Set up logging # Set up logging