add a verbose logging option and format the logs

This commit is contained in:
Brian Kelly 2022-10-31 13:24:04 -06:00
parent 5d010d653b
commit 894f042688

View File

@ -23,23 +23,26 @@ void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QS
return; return;
} }
QString msg, typestr; QString msg, typestr, contextstr;
#ifdef VERBOSE_LOGGING
contextstr = QString(context.file) + " " + context.function + ":" + QString::number(context.line) + " ";
#endif
switch (type) { switch (type) {
case QtWarningMsg: case QtWarningMsg:
typestr = QString("Warning: "); typestr = QString("Warning: ") + contextstr;
break; break;
case QtFatalMsg: case QtFatalMsg:
typestr = QString("Fatal: "); typestr = QString("Fatal: ") + contextstr;
break; break;
case QtCriticalMsg: case QtCriticalMsg:
typestr = QString("Critical: "); typestr = QString("Critical: ") + contextstr;
break; break;
default: default:
typestr = QString("Debug: "); typestr = QString("Debug: ") + contextstr;
break; break;
} }