From c2b42f29d787cf2097f93c60f0326ca409c0362b Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 22 Aug 2023 10:47:00 -0400 Subject: [PATCH] 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 --- src/cephadm/cephadmlib/logging.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cephadm/cephadmlib/logging.py b/src/cephadm/cephadmlib/logging.py index dc8da38368366..b682da90384b9 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) -- 2.39.5