3 # jose.lausuch@ericsson.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
19 # import functest_logger as fl
20 # logger = fl.Logger("script_name").getLogger()
21 # logger.info("message to be shown with - INFO - ")
22 # logger.debug("message to be shown with - DEBUG -")
29 from functest.utils.constants import CONST
34 def __init__(self, logger_name):
36 self.logger = logging.getLogger(logger_name)
37 logging.getLogger("paramiko").setLevel(logging.WARNING)
43 if CONST.CI_DEBUG and CONST.CI_DEBUG.lower() == "true":
47 def setup_logging(self, default_path=CONST.dir_functest_logging_cfg,
48 default_level=logging.INFO,
51 value = os.getenv(env_key, None)
54 if os.path.exists(path):
55 with open(path, 'rt') as f:
57 if (config['handlers'] and
58 config['handlers']['console']):
59 stream_level = logging.INFO
61 stream_level = logging.DEBUG
62 config['handlers']['console']['level'] = stream_level
63 logging.config.dictConfig(config)
65 logging.basicConfig(level=default_level)