The Python logging tutorial says that the newer ways of formatting are beyond the scope of the tutorial, without mentioning where to learn about it.
I would appreciate any examples or link to documentation that allow me to use .format() style message formatting in logging calls such as debug(), info(), etc.
Recently, I was looking for that too. I think I got pointed to the solution here on SO, but I only have the final url at hand. This is what I do:
Can be used like this:
The formatting will only take place in the very moment the message is evaluated, so you don’t lose lots of performance if a log level is disabled. The author of that snippet above made this (and some other utilities) available as a package:
logutils.