Hi,
I've been working on a patch to the Qt logging framework:
http://codereview.qt-project.org/#change,13433,patchset=14 . Basically it
redefines qDebug() and friends as a macro so that we can automatically capture
the source file, line, and function a particular message comes from:
qDebug("Hello world")
actually is changed by the precompiler to:
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO):debug("Hello World")
The additional information can then be processed in a custom message handler,
that also got a new signature:
void myMessageHandler(QtMsgType type, const QMessageLogContext &context, const
char *msg)
{
switch (type) {
case QtDebugMsg:
printf("DBG: %s (%s:%i in %s)\n", msg, context.file, context.line,
context.function); }
break;
// ...
}
int main(int argc, char **argv)
{
qInstallMessageHandler(myMessageHandler);
}
The patch is almost ready to go in ... Anyhow, the question is whether there's
additional things we need to have in QtCore to make the logging framework of Qt
first-class? See my second mail regarding debug areas ...
--
Kai Koehne
Software Engineer
Nokia, Qt Development Frameworks
Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development