自分Debug systemで管理しようとしQtていますが、いくつか問題があります。
main.h
#include <QCoreApplication>
#include "PhTools/PhDebug.h"
int main(int argc, char *argv[])
{
    // Test of Debug tool
    DEBUG << "Test";
    // Test of TimeCode
    for(int i=0; i<3;i++)
    {
        if(false)
            DEBUG << "problem with me";
    }
    return 0;
}
PhDebug.h
#ifndef PHDEBUG_H
#define PHDEBUG_H
#include <QDebug>
#include <QDate>
#include <QRect>
#define DEBUG PhDebug d; d <<  PHDEBUG
#define PHDEBUG  qDebug() << __FUNCTION__ << ":"
// In order to get rid of double quotes when displaying a variable
#define Q(string) (string).toStdString().c_str()
class PhDebug
{
public:
    QDebug operator<<(QDebug dbg)
    {
        QString d;
        d = QDate::currentDate().toString("dd.MM.yyyy");
        d += " - ";
        d += QTime::currentTime().toString("hh.mm.ss.zzz");
        d += " in";
        dbg << Q(d);
        return dbg;
    }
};
#endif // PHDEBUG_H
したがって、出力は次のようになります04.09.2013 - 12.30.51.513 in main : Testが、代わりに次のようになります。
04.09.2013 - 12.30.51.513 in main : Test 
04.09.2013 - 12.30.51.514 in main : problem with me 
04.09.2013 - 12.30.51.514 in main : problem with me 
04.09.2013 - 12.30.51.514 in main : problem with me