diff options
-rw-r--r-- | yardstick/__init__.py | 13 | ||||
-rw-r--r-- | yardstick/cmd/cli.py | 13 |
2 files changed, 9 insertions, 17 deletions
diff --git a/yardstick/__init__.py b/yardstick/__init__.py index 1ad6eb0b1..e19be36fd 100644 --- a/yardstick/__init__.py +++ b/yardstick/__init__.py @@ -35,19 +35,18 @@ LOG = logging.getLogger(__name__) def _init_logging(): - _LOG_STREAM_HDLR.setFormatter(_LOG_FORMATTER) + LOG.setLevel(logging.DEBUG) + _LOG_STREAM_HDLR.setFormatter(_LOG_FORMATTER) + if os.environ.get('CI_DEBUG', '').lower() in {'1', 'y', "yes", "true"}: + _LOG_STREAM_HDLR.setLevel(logging.DEBUG) + else: + _LOG_STREAM_HDLR.setLevel(logging.INFO) # don't append to log file, clobber _LOG_FILE_HDLR.setFormatter(_LOG_FORMATTER) - # set log file to store debug info _LOG_FILE_HDLR.setLevel(logging.DEBUG) del logging.root.handlers[:] logging.root.addHandler(_LOG_STREAM_HDLR) logging.root.addHandler(_LOG_FILE_HDLR) logging.debug("logging.root.handlers = %s", logging.root.handlers) - - if os.environ.get('CI_DEBUG', '').lower() in {'1', 1, 'y', "yes", "true"}: - LOG.setLevel(logging.DEBUG) - else: - LOG.setLevel(logging.INFO) diff --git a/yardstick/cmd/cli.py b/yardstick/cmd/cli.py index 6281bb813..1f8dfee2d 100644 --- a/yardstick/cmd/cli.py +++ b/yardstick/cmd/cli.py @@ -20,7 +20,7 @@ from pkg_resources import get_distribution from argparse import RawDescriptionHelpFormatter from oslo_config import cfg -from yardstick import _init_logging, LOG +from yardstick import _init_logging, _LOG_STREAM_HDLR from yardstick.cmd.commands import task from yardstick.cmd.commands import runner from yardstick.cmd.commands import scenario @@ -33,11 +33,7 @@ cli_opts = [ cfg.BoolOpt('debug', short='d', default=False, - help='increase output verbosity to debug'), - cfg.BoolOpt('verbose', - short='v', - default=False, - help='increase output verbosity to info') + help='increase output verbosity to debug') ] CONF.register_cli_opts(cli_opts) @@ -132,11 +128,8 @@ class YardstickCLI(): def _handle_global_opts(self): _init_logging() - if CONF.verbose: - LOG.setLevel(logging.INFO) - if CONF.debug: - LOG.setLevel(logging.DEBUG) + _LOG_STREAM_HDLR.setLevel(logging.DEBUG) def _dispath_func_notask(self): |