Idiomatic Python logging: format string + args list vs. inline string formatting - which is preferred?
Is it advantageous to call logging functions with format string + args list vs. formatting inline? I've seen (and written) logging code that uses inline string formatting: logging.warn("%s %s %s" % (arg1, arg2, arg3)) and yet I assume it's better (performance-wise, and more idiomatic) to use: logging.warn("%s %s %s", arg1, arg2, arg3) because the second form avoids string formatting operations prior to invoking the logging function. If the current logging level would filter out the log message, no formatting is necessary, reducing computing time and memory allocations. Am I on the right track