W1203 logging-fstring-interpolation

Message

'Use %s formatting in logging functions'

Description

Used when a logging statement has a call form of “logging.<logging method>(f”…”)”.Use another type of string formatting instead. You can use % formatting but leave interpolation to the logging function by passing the parameters as arguments. If logging-format-interpolation is disabled then you can use str.format. If logging-not-lazy is disabled then you can use % formatting as normal.

Example

import logging
a = 1
b = 2
logging.debug(f"State: {a}, {b}")
4:0: W1203: Use lazy % formatting in logging functions

Here is how you should use it:

import logging
a = 1
b = 2
logging.debug("State: %d, %d", a, b)
No issues found.

Running Pylint locally? In your CI?

There is a better way! Run PyCodeQual & get Pylint findings with history, diffs and statistics.

Click here to find out more.