added custom debug handler

This commit is contained in:
itsmattkc
2019-09-10 23:44:35 +10:00
parent 69ca2b2a50
commit 6dc62a8703
8 changed files with 50 additions and 6 deletions
+28
View File
@@ -0,0 +1,28 @@
#include "debug.h"
void DebugHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
QByteArray localMsg = msg.toLocal8Bit();
const char* msg_type;
switch (type) {
case QtDebugMsg:
msg_type = "DEBUG";
break;
case QtInfoMsg:
msg_type = "INFO";
break;
case QtWarningMsg:
msg_type = "WARNING";
break;
case QtCriticalMsg:
msg_type = "ERROR";
break;
case QtFatalMsg:
msg_type = "FATAL";
break;
}
fprintf(stderr, "[%s] %s (%s:%u)\n", msg_type, localMsg.constData(), context.function, context.line);
}