[Python-ideas] Efficient debug logging
Abe Dillon
abedillon at gmail.com
Tue Feb 14 19:51:08 EST 2017
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.
This sounds like an optimization that's sufficiently rare and complex to
warrant a custom fix or a 3rd party library.
Not that it is relivent for this idea bit logging's levels are too
course for logging in complete
applications. The app I am working on at the moment has 20 seperate
debug categories
that are independently enabled.
Holy balls! That sounds like a tortured use of log levels!
On Tue, Feb 14, 2017 at 3:55 PM, Barry <barry at barrys-emacs.org> wrote:
>
> On 14 Feb 2017, at 17:03, Cory Benfield <cory at lukasa.co.uk> wrote:
>
>
> 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,
> 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 at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170214/0b096152/attachment.html>
More information about the Python-ideas
mailing list