PY3.W1203

Logging fstring interpolation

Used when a logging statement has a call form of "logging.logging_method(f"...")". Use another type of string formatting instead. Y ou can use %formatting but leave interpolation to the logging function by passing theparameters as arguments. If logging-format-interpolation is disabled then youcan use str.format. If logging-not-lazy is disabled then you can use %formatting as normal.

Noncompliant Code:

Copy
import logging
import sys

logging.error(f'Python version: {sys.version}')

Compliant Code:

Copy
import logging
import sys

logging.error('Python version: %s', sys.version)

The content on this page is adapted from the Pylint User Guide, Copyright ©2003-2022, Logilab, PyCQA and contributors. All rights reserved. https://pylint.pycqa.org/en/latest/index.html#, and is used under the Python Software Foundation License Version 2. Examples, recipes, and other code in the Pylint documentation are additionally licensed under the Zero Clause BSD License.