[Development] Work on qDebug and friends - debug areas
Lincoln Ramsay
lincoln.ramsay at nokia.com
Fri Jan 27 02:15:16 CET 2012
On 01/24/2012 09:03 PM, ext kai.koehne at nokia.com wrote:
> One of the things still missing in the current debugging framework is
> to categorize messages by area: This would allow you to
> enable/disable e.g. debug messages for only one part of your app ...
...
> That's at least what I got after doing 10 minutes of research :)
> Question is whether we want to have any of the approaches (or both)
> in QtCore?
Another data point...
The qLog approach (from Qtopia) uses macros to turn "strings" into
classnames.
something like...
DECLARE_CATEGORY(x)
expanding to
class QLog_Category_x ...
Then qLog(x) expanded to
if (!QLog_Category_x::enabled()); QLog_Category_x::debug()
I guess the primary downside with this is the need to either centrally
locate the declarations or duplicate the declarations in every .cpp file
that needs them.
However, this gives you string-based categories without the cost of
string comparisons and I suspect the size cost of the logging messages
is larger than the cost of the category classes.
--
Lincoln Ramsay - Senior Software Engineer
Qt Development Frameworks, Nokia - http://qt.nokia.com/
More information about the Development
mailing list