how to use logging module to log an object like print()
vinay_sajip at yahoo.co.uk
Wed Oct 29 14:17:52 CET 2008
On Oct 29, 11:24 am, Steve Holden <st... at holdenweb.com> wrote:
> One deficiency of this approach, however, is that the string formatting
> is performed even when nologgingis required, thereby wasting a certain
> amount of effort on unnecessary formatting.
Though you can mitigate this using the pattern:
logger.debug("Message with variable data which may be expensive:
Which will only make the expensive_call() and formatting when the
logging call will actually do something.
More information about the Python-list