#ifndef QT_NO_DEBUG_OUTPUT
void logMessageHandler(QtMsgType type, const char *msg)
{
QString debugdate = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss");
switch (type)
{
case QtDebugMsg:
debugdate += "[D]";
break;
case QtWarningMsg:
debugdate += "[W]";
break;
case QtCriticalMsg:
debugdate += "[C]";
break;
case QtFatalMsg:
debugdate += "[F]";
break;
}
fprintf(stderr, "%s %s\n", debugdate.toLatin1().data(), msg);
if (QtFatalMsg == type) {
abort();
}
}
#endif
int main(int argc, char **argv)
{
#ifndef QT_NO_DEBUG_OUTPUT
qInstallMsgHandler(logMessageHandler);
#endif
}
Comments
0 B
|👍
/👎
0 B
|👍
/👎