diff --git a/src/functions/__init__.py b/src/functions/__init__.py index 45e71c8..cf87eb1 100644 --- a/src/functions/__init__.py +++ b/src/functions/__init__.py @@ -104,7 +104,7 @@ class Functions: FATAL = "FATAL" @staticmethod - def skip_log(source, log_level_str): + def setup_log(source): level = os.getenv("%s_LOG_LEVEL" % (source.name.upper()), "").upper() level_importance = { Functions.TRACE: logging.DEBUG, @@ -426,7 +426,7 @@ loggerInit = logging.getLogger(Functions.INIT_LOG) loggerHaproxy = logging.getLogger(Functions.HAPROXY_LOG) loggerEasyHaproxy = logging.getLogger(Functions.EASYHAPROXY_LOG) loggerCertbot = logging.getLogger(Functions.CERTBOT_LOG) -Functions.skip_log(loggerInit, Functions.INIT_LOG) -Functions.skip_log(loggerHaproxy, Functions.HAPROXY_LOG) -Functions.skip_log(loggerEasyHaproxy, Functions.EASYHAPROXY_LOG) -Functions.skip_log(loggerCertbot, Functions.CERTBOT_LOG) +Functions.setup_log(loggerInit) +Functions.setup_log(loggerHaproxy) +Functions.setup_log(loggerEasyHaproxy) +Functions.setup_log(loggerCertbot) diff --git a/src/tests/test_functions.py b/src/tests/test_functions.py index f9670c9..0ab4c00 100644 --- a/src/tests/test_functions.py +++ b/src/tests/test_functions.py @@ -18,20 +18,20 @@ loggerDebug.setLevel(logging.DEBUG) loggerDebug.addHandler(log_handler) def test_functions_check_local_level(): - assert Functions.skip_log(loggerCertbot, Functions.INFO) == logging.INFO - assert Functions.skip_log(loggerHaproxy, Functions.INFO) == logging.INFO - assert Functions.skip_log(loggerEasyHaproxy, Functions.INFO) == logging.INFO + assert Functions.setup_log(loggerCertbot) == logging.INFO + assert Functions.setup_log(loggerHaproxy) == logging.INFO + assert Functions.setup_log(loggerEasyHaproxy) == logging.INFO os.environ['CERTBOT_LOG_LEVEL'] = 'warn' - assert Functions.skip_log(loggerCertbot, Functions.WARN) == logging.WARNING + assert Functions.setup_log(loggerCertbot) == logging.WARNING del os.environ['CERTBOT_LOG_LEVEL'] os.environ['HAPROXY_LOG_LEVEL'] = 'warn' - assert Functions.skip_log(loggerHaproxy, Functions.INFO) == logging.WARNING + assert Functions.setup_log(loggerHaproxy) == logging.WARNING del os.environ['HAPROXY_LOG_LEVEL'] os.environ['EASYHAPROXY_LOG_LEVEL'] = 'warn' - assert Functions.skip_log(loggerEasyHaproxy, Functions.INFO) == logging.WARNING + assert Functions.setup_log(loggerEasyHaproxy) == logging.WARNING del os.environ['EASYHAPROXY_LOG_LEVEL']