> On 14 Feb 2017, at 17:03, Cory Benfield <c...@lukasa.co.uk> wrote: > > >> On 14 Feb 2017, at 15:51, Barry Scott <ba...@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, > is not sufficient for this?
The point is that the cost of creating the msg argument can be very high. At the point that logging decides to skip output it is to late to save the cost of creating the arg tuple. Not that it is relivent for this idea bit logging's levels are too course for logging in complex applications. The app I am working on at the moment has 20 seperate debug categories that are independently enabled. Barry > Cory
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/