Enable logging related ruff checks

... to extend the enforced format rules related to logging.

Change-Id: I53fa4f46ebfd015803c867410fef662eb68bf340
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-12-11 17:01:37 +09:00
parent a1279f7b98
commit 310f6c8895
4 changed files with 4 additions and 4 deletions

View File

@@ -81,7 +81,7 @@ def prepare():
LOG.info("List of Oslo Logging configuration options and current values")
LOG.info("=" * 80)
for c in CONF:
LOG.info(f"{c} = {CONF[c]}")
LOG.info("%s = %s", c, str(CONF[c]))
LOG.info("=" * 80)
# Required setup based on configuration and domain

View File

@@ -145,7 +145,7 @@ class ColorHandler(logging.StreamHandler):
logging.DEBUG: '\033[00;32m', # GREEN
logging.INFO: '\033[00;36m', # CYAN
_AUDIT: '\033[01;36m', # BOLD CYAN
logging.WARN: '\033[01;33m', # BOLD YELLOW
logging.WARNING: '\033[01;33m', # BOLD YELLOW
logging.ERROR: '\033[01;31m', # BOLD RED
logging.CRITICAL: '\033[01;31m', # BOLD RED
}

View File

@@ -1166,7 +1166,7 @@ class FancyRecordTestCase(LogTestBase):
def _validate_keys(self, ctxt, keyed_log_string):
infocolor = handlers.ColorHandler.LEVEL_COLORS[logging.INFO]
warncolor = handlers.ColorHandler.LEVEL_COLORS[logging.WARN]
warncolor = handlers.ColorHandler.LEVEL_COLORS[logging.WARNING]
info_msg = 'info'
warn_msg = 'warn'
infoexpected = f"{infocolor} {keyed_log_string} {info_msg}"

View File

@@ -56,7 +56,7 @@ quote-style = "preserve"
docstring-code-format = true
[tool.ruff.lint]
select = ["E4", "E5", "E7", "E9", "F", "S", "UP"]
select = ["E4", "E5", "E7", "E9", "F", "G", "LOG", "S", "UP"]
ignore = [
# we want to test printf-style formatting
"UP031"