config: Add -C/--console parameter

This commit is contained in:
Benjamin Renard 2021-11-18 19:55:44 +01:00
parent f8225bfbc9
commit 4691ba7386

View file

@ -573,6 +573,13 @@ class Config:
help='Show verbose messages' help='Show verbose messages'
) )
self.options_parser.add_argument(
'-C',
'--console',
action='store_true',
help='Log on console'
)
self.add_options_to_parser(self.options_parser) self.add_options_to_parser(self.options_parser)
return self.options_parser return self.options_parser
@ -623,6 +630,10 @@ class Config:
elif options.verbose: elif options.verbose:
logging.getLogger().setLevel(logging.INFO) logging.getLogger().setLevel(logging.INFO)
if options.console:
console_handler = logging.StreamHandler(sys.stdout)
logging.getLogger().addHandler(console_handler)
self._loaded() self._loaded()
return options return options