diff options
author | rexlee8776 <limingjiang@huawei.com> | 2017-02-27 10:49:57 +0000 |
---|---|---|
committer | rexlee8776 <limingjiang@huawei.com> | 2017-02-28 08:27:54 +0000 |
commit | 806008ab5f3bc912c9c23d4c1fff6253a50e77ed (patch) | |
tree | 0f0dd8c9b4000df19007ff3ff5520dd7f4d8bf5b /yardstick/__init__.py | |
parent | 177feabf43564afd28c7b4112ad4e384a3654bd8 (diff) |
stream default INFO, filehdr default DEBUG
The DEBUG log can be stored as file and pushed into artifacts.
Default sys.out level should be INFO. Stream level can be
changed to DEBUG if cli "-d" is enabled.
remove "-v" since it's not useful for a test framework
JIRA: YARDSTICK-507
Change-Id: I3caafd31a2caac73b0e3f33c2762c090e76c707e
Signed-off-by: rexlee8776 <limingjiang@huawei.com>
Diffstat (limited to 'yardstick/__init__.py')
-rw-r--r-- | yardstick/__init__.py | 13 |
1 files changed, 6 insertions, 7 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) |