[Development] QLog ( Work on qDebug and friends)

wolfgang.beck at nokia.com wolfgang.beck at nokia.com
Tue Feb 7 07:54:55 CET 2012

I'm working to integrade category log with QMessageLogger & Co and unfortunatelly we can not use
qDebg(<category>) << "my message" because there is already a debug(const char *msg, ...) function
combining with the macro 
#define qDebug QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debug.

So I use a new function and macro:
    QDebug debug();
    QDebug debugCategory(const char *msg);
    QDebug warning();
    QDebug warningCategory(const char *msg);
    QDebug critical();
    QDebug criticalCategory(const char *msg);
    QDebug fatalCategory(const char *msg);

#define qDebugCat(category) QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debugCategory(#category)
#define qWarningCat(category) QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).warningCategory(#category)
#define qCriticalCat(category) QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).criticalCategory(#category)
#define qFatalCat(category) QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).fatalCategory(#category)

Any problems with this naming conventions???


More information about the Development mailing list