Why use multiple arguments to log instead of interpolation?

Viewed 836

Python's logging functions allow you to pass them multiple arguments that they can interpolate for you. So you have a choice:

logger.info("Something %s this way comes!" % "wicked")

or

logger.info("Something %s this way comes!", "wicked")

But why choose one over the other? Is it simply a matter of letting errors happen in the logger as opposed to in the program that's being logged, or is there something else to it?

1 Answers
Related