[Development] Work on qDebug and friends - debug areas
olivier at woboq.com
Wed Jan 25 14:03:05 CET 2012
On Tuesday 24 January 2012 11:03:11 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 ...
> KDE & kDebug
> Here debug categories are basically ints, which have to be registered
> 'kdelibs/kdecore/kdebug.areas'. You can pass your specific as an argument
> to kDebug(..) et al., but usually you just set a define
> + comparing int's is fast
> - one central registry needed for debug areas (no go for custom apps?)
May I suggest we use something like qHash("MyModule")
And ignore the fact that there are collisions. (you only would loose a bit
granularity in rare occasions.)
> Log4cxx ...
> Frameworks like log4cxx
> (http://www.360doc.com/content/09/0508/23/36491_3425784.shtml) that are
> modeled after log4j use free text to define areas. Also, the areas might be
> nested, so that "MyModule " includes "MyModule.Part" semantically, and you
> can do very fine grain adjustments on what exactly to log.
> + Lots of flexibility
> - comparing strings is slow, chances that you mistype ...
you can reduce the mistype changes my using macro or static char*
How slow is it really, compared to the cost of streaming the different types
to string and concatenating them?
Also qDebug will get disabled in release, right?
More information about the Development