From: John Mulligan Date: Tue, 22 Aug 2023 14:47:00 +0000 (-0400) Subject: cephadm: mark types private to the new logging.py as private X-Git-Tag: v19.0.0~509^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c2b42f29d787cf2097f93c60f0326ca409c0362b;p=ceph-ci.git cephadm: mark types private to the new logging.py as private The config dicts and filter type are not used outside of the logging.py file. Add the starting underscore convention to make this clear to readers. Signed-off-by: John Mulligan --- diff --git a/src/cephadm/cephadmlib/logging.py b/src/cephadm/cephadmlib/logging.py index dc8da383683..b682da90384 100644 --- a/src/cephadm/cephadmlib/logging.py +++ b/src/cephadm/cephadmlib/logging.py @@ -14,7 +14,7 @@ from .constants import QUIET_LOG_LEVEL, LOG_DIR # During normal cephadm operations (cephadm ls, gather-facts, etc ) we use: # stdout: for JSON output only # stderr: for error, debug, info, etc -logging_config = { +_logging_config = { 'version': 1, 'disable_existing_loggers': True, 'formatters': { @@ -43,7 +43,7 @@ logging_config = { } -class ExcludeErrorsFilter(logging.Filter): +class _ExcludeErrorsFilter(logging.Filter): def filter(self, record: logging.LogRecord) -> bool: """Only lets through log messages with log level below WARNING .""" return record.levelno < logging.WARNING @@ -52,11 +52,11 @@ class ExcludeErrorsFilter(logging.Filter): # When cephadm is used as standard binary (bootstrap, rm-cluster, etc) we use: # stdout: for debug and info # stderr: for errors and warnings -interactive_logging_config = { +_interactive_logging_config = { 'version': 1, 'filters': { 'exclude_errors': { - '()': ExcludeErrorsFilter + '()': _ExcludeErrorsFilter } }, 'disable_existing_loggers': True, @@ -116,9 +116,9 @@ def cephadm_init_logging( os.makedirs(LOG_DIR) operations = ['bootstrap', 'rm-cluster'] if any(op in args for op in operations): - logging.config.dictConfig(interactive_logging_config) + logging.config.dictConfig(_interactive_logging_config) else: - logging.config.dictConfig(logging_config) + logging.config.dictConfig(_logging_config) logger.setLevel(QUIET_LOG_LEVEL)