New submission from Lluís <llpam...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue14868>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to