main: Set up logger before reading config file.
Let the user see errors reported in read_paths.
This commit is contained in:
parent
f0c0ab9f2c
commit
8c722dece1
1 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue