Configure logging with debug flag

Configure the logging level for the client with debug flag
and format the output like other openstack projects.

Change-Id: I1962909b1b5f028842af388c38962e78cebd0399
This commit is contained in:
Zhenguo Niu 2015-07-02 21:21:06 +08:00
parent 27d35b103e
commit d3ea91f615

View File

@ -110,7 +110,10 @@ class MistralShell(app.App):
self._set_shell_commands(self._get_commands_v2())
def configure_logging(self):
super(MistralShell, self).configure_logging()
log_lvl = logging.DEBUG if self.options.debug else logging.WARNING
logging.basicConfig(
format="%(levelname)s (%(module)s) %(message)s",
level=log_lvl)
logging.getLogger('iso8601').setLevel(logging.WARNING)
if self.options.verbose_level <= 1:
logging.getLogger('requests').setLevel(logging.WARNING)