Reputation: 87
For any defined valriable 'e', what's the difference b/w:
logging.info("variable is : %s" % e)
and loggin.info("variable is : ", e)
and when to use what? which one will be better for UTs ?
Upvotes: 0
Views: 38
Reputation: 11486
The second one will throw an exception if you have info logging enabled, you should use logging.info("variable is : %s", e)
, this way you only format the string if the message is going to be logged.
Upvotes: 1