PyLint message: logging-format-interpolation

For the following code:

logger.debug('message: {}'.format('test'))

pylint produces the following warning:

logging-format-interpolation (W1202):

Use % formatting in logging functions and pass the % parameters as
arguments Used when a logging statement has a call form of
“logging.(format_string.format(format_args…))”. Such
calls should use % formatting instead, but leave interpolation to the
logging function by passing the parameters as arguments.

I know I can turn off this warning, but I’d like to understand it. I assumed using format() is the preferred way to print out statements in Python 3. Why is this not true for logger statements?

4 Answers
4

Leave a Comment