[Development] QLog ( Work on qDebug and friends)
lincoln.ramsay at nokia.com
Fri Feb 17 00:19:04 CET 2012
On 02/17/2012 01:01 AM, ext David Faure wrote:
> So why not *change* the qDebug macro to something like
> if (!global_enabled()) /*NOP*/; else QMessageLogger(__FILE__, __LINE__,
Please see the other thread with BRM. He advocates the same kind of
approach. I'm not going to repeat the reasons why this is not acceptable.
> The goal: that global_enabled() affects *all* qDebug statements, not only those
> with a category
Unlike qLog (which defaults to off), qDebug must be on by default or we
break all existing code. This means a "runtime" switch for qDebug would
only serve to turn all qDebugs off.
Is this really a useful thing? Qt itself has no qDebug statements but
perhaps other, third party libraries have left them in. In that case,
having a runtime disable option may be warranted.
Is that what you meant?
> (try to explain to a new developer, the reason
> why the global switch to disable debug output
There is no "global switch" to "disable debug output" with qLog. Please
read the code before commenting on the implementation.
>The only reason is "well, I didn't dare to touch qDebug itself"?
> I think it's the right time to touch it :-)
As has already been covered, the C++ language does not let us overload
the qDebug macro with category support and overloading at the function
level results in a potentially large performance hit.
Lincoln Ramsay - Senior Software Engineer
Qt Development Frameworks, Nokia - http://qt.nokia.com/
More information about the Development