main: Set up logger before reading config file.

Let the user see errors reported in read_paths.
This commit is contained in:
Brett Smith 2020-01-27 09:36:04 -05:00
parent f0c0ab9f2c
commit 8c722dece1

View file

@ -36,10 +36,12 @@ def setup_logger(logger, loglevel, stream):
def main(arglist=None, stdout=sys.stdout, stderr=sys.stderr): def main(arglist=None, stdout=sys.stdout, stderr=sys.stderr):
args = parse_arguments(arglist) args = parse_arguments(arglist)
root_logger = logging.getLogger()
config = config_mod.Config() config = config_mod.Config()
setup_logger(root_logger, config.get_loglevel(), stderr)
for _ in config.read_paths([args.config_file]): for _ in config.read_paths([args.config_file]):
pass pass
setup_logger(logging.getLogger(), config.get_loglevel(logging.WARNING), stderr) root_logger.setLevel(config.get_loglevel())
if not config.ready(): if not config.ready():
return 3 return 3
bot = bot_mod.ForwardBot(config) bot = bot_mod.ForwardBot(config)