]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: mark types private to the new logging.py as private
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 22 Aug 2023 14:47:00 +0000 (10:47 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 5 Sep 2023 18:52:16 +0000 (14:52 -0400)
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 <jmulligan@redhat.com>
src/cephadm/cephadmlib/logging.py

index dc8da38368366135f630f885ad7f219586574bea..b682da90384b94b026a7554e90596f64c7c10a9e 100644 (file)
@@ -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)