From 2fc9b4f5ea9cb6e01f7116a099e63b197181f71a Mon Sep 17 00:00:00 2001 From: Randall Burt Date: Tue, 28 Jan 2014 13:31:37 -0500 Subject: [PATCH] Configure logging regardless of debug flag Configure the logging level for the client. Default to ERROR unless -d is passed, then use DEBUG. Closes-Bug: #1273800 Change-Id: Iea337bed55ca7da2fc95d0d3218a4895909423cd --- heatclient/shell.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/heatclient/shell.py b/heatclient/shell.py index 9d136a6f..c6fa9478 100644 --- a/heatclient/shell.py +++ b/heatclient/shell.py @@ -271,11 +271,11 @@ class HeatShell(object): service_type=kwargs.get('service_type') or 'orchestration', endpoint_type=kwargs.get('endpoint_type') or 'publicURL') - def _setup_debugging(self, debug): - if debug: - logging.basicConfig( - format="%(levelname)s (%(module)s:%(lineno)d) %(message)s", - level=logging.DEBUG) + def _setup_logging(self, debug): + log_lvl = logging.DEBUG if debug else logging.ERROR + logging.basicConfig( + format="%(levelname)s (%(module)s:%(lineno)d) %(message)s", + level=log_lvl) def _setup_verbose(self, verbose): if verbose: @@ -285,7 +285,7 @@ class HeatShell(object): # Parse args once to find version parser = self.get_base_parser() (options, args) = parser.parse_known_args(argv) - self._setup_debugging(options.debug) + self._setup_logging(options.debug) self._setup_verbose(options.verbose) # build available subcommands based on version