2

I was wondering if there's an actual usage of the args option that is passed into a logging call that cannot be done with string-formatting. For example:

logging.info('hello, %s' % 'Bob')

vs.

logging.info('hello, %s', 'Bob')

Are these two variations to do the same thing? Or is there actually some use with passing in args to the logging call that you cannot do with string formatting?

David542
  • 104,438
  • 178
  • 489
  • 842
  • The result is the same but the second variant is more performant. See [this question](https://stackoverflow.com/questions/11955787/idiomatic-python-logging-format-string-args-list-vs-inline-string-formatting) for a detailed discussion. – Selcuk Dec 12 '19 at 00:42

0 Answers0