On Oct 29, 11:24 am, Steve Holden <[EMAIL PROTECTED]> 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:
if logger.isEnabledFor(logging.DEBUG):
logger.debug("Message with variable data which may be expensive:
%s", expensive_call())
Which will only make the expensive_call() and formatting when the
logging call will actually do something.
Regards,
Vinay Sajip
--
http://mail.python.org/mailman/listinfo/python-list