rename skip_log to setup_log
This commit is contained in:
parent
06ea2bbd3f
commit
6df8e39bb1
2 changed files with 11 additions and 11 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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']
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue