[Python-ideas] Efficient debug logging

Cory Benfield cory at lukasa.co.uk
Tue Feb 14 12:03:22 EST 2017

> On 14 Feb 2017, at 15:51, Barry Scott <barry at barrys-emacs.org> wrote:
> And have the evaluation of the argument skipped unless its dbg_log is enabled.
> I cannot see how to do this with python as it stands.
> Something would have to be added to allow python to short circuit the argument tuple evaluation.
> Maybe python can check for a special dunder on the class that know how to do this idiom, __if_true_call__?

Is there any reason logger.isEnabledFor(level), as shown in the docs https://docs.python.org/2/library/logging.html#logging.Logger.isEnabledFor <https://docs.python.org/2/library/logging.html#logging.Logger.isEnabledFor>, is not sufficient for this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170214/6dc9858a/attachment.html>

More information about the Python-ideas mailing list