[New-bugs-announce] [issue14868] Allow log calls to return True for code optimization.

Lluís report at bugs.python.org
Mon May 21 09:56:09 CEST 2012


New submission from Lluís <llpamies at pamies.cat>:

One of the problems with the logging library is that it can affect code performance when logging calls are over-utilized.

One possible solution would be to allow the compiler to remove logging calls when code is optimized with "python -O" by wrapping log calls with an assert:

   assert logging.debug("This is a test.")

Note that now debug(), info(), etc in the logging module always return "None" and this is not possible. An enhancement would be to make all logging calls to return True. In normal conditions messages would be logged without raising any error, but in optimized code they would never be called.

It is really easy to implement and I would be pleased to provide a patch for this, but I want to receive feedback from python core developers.

Thanks…

----------
components: Library (Lib)
messages: 161251
nosy: Lluís
priority: normal
severity: normal
status: open
title: Allow log calls to return True for code optimization.
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14868>
_______________________________________


More information about the New-bugs-announce mailing list