[issue21912] Deferred logging may use outdated references

Vinay Sajip report at bugs.python.org
Thu Jul 3 16:20:52 CEST 2014


Vinay Sajip added the comment:

> I don't see a reason to defer the formatting to the actual output of the messages (other than the current implementation of logging).

The current implementation of logging is like that for a reason, even though you may not see it - it defers doing work until it is needed (which improves throughput). This idiom is hardly uncommon.

If you don't want to delay formatting until output, you can always do

logger.debug("My object: %s" % myObject)

----------
resolution:  -> not a bug
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21912>
_______________________________________


More information about the Python-bugs-list mailing list