[Development] QLog ( Work on qDebug and friends)
david.faure at kdab.com
Thu Feb 2 13:22:11 CET 2012
On Thursday 02 February 2012 12:52:38 =?ISO-8859-1?Q?Andr=E9?= Somers wrote:
> I think there are plenty of implementations doing this already. Take a
> look at QxtLogger for instance. It can be used with the output handler
> just fine, but it also allows more finegrained access with more than
> four levels. It also supports multiple outputs.
> I see no need to make all this part of Qt *now*, especially not of core.
> The very existence of external libraries that integrate with the current
> structure shows that it is exendable enough.
Well, Qxt and kdelibs are entire frameworks on top of Qt, but this makes the
lib code very inconsistent, and not every little app wants to link to a big
framework, especially for something as small as debug output handling.
I want to get rid of KDE's kDebug so that there is less difference between "a
Qt-based library" and "a KDE-based library". The last hurdle for that is:
1) showing more information (file, line, method, process name and PID) in the
default message handler, probably based on env vars (easy to add now that
QMessageLogContext has the necessary information).
2) support for debug areas. QLog's way of defining areas looks very nice, but
it should be integrated with qDebug, as discussed previously.
Again, this is about standardizing the debug statements in all qt-based libs,
it doesn't prevent external loggers handling for the output in customized ways
in specific apps or frameworks.
In fact, because of the lack of debug areas, Qt code itself can't leave a
single debug statement uncommented. Parts of Qt are full of #ifdefs to disable
debug output by default. This could be done much better by registering an area
and asking for it to be disabled by default. Then people could enable
debugging from e.g. qsslsocket or QNAM or qimagereader without recompiling Qt
[qdbus has a custom solution for this, $QDBUS_DEBUG, showing that is really a
need for this]. I think this clearly shows there is a need for something
better in QtCore. Extra code in external libraries doesn't solve this core
David Faure | david.faure at kdab.com | KDE/Qt Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
More information about the Development