mirror of
https://github.com/YACReader/yacreader
synced 2025-07-14 02:54:46 -04:00
Stop QtWebApp from eating out debug messages
QtWebapp installs a custom logger/message handler which reroutes all debug messages to it's custom logger class. As the default logging level for QtWebApp's logger is set to "critical" this means that all debug messages are sent to nirvana. Solution: Replace QtWebApp's messageHandler with our own (using QsLog).
This commit is contained in:
@ -80,8 +80,47 @@ void logSystemAndConfig()
|
||||
QLOG_INFO() << "--------------------------------------------";
|
||||
}
|
||||
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg)
|
||||
{
|
||||
Q_UNUSED(context);
|
||||
|
||||
QByteArray localMsg = msg.toLocal8Bit();
|
||||
switch (type)
|
||||
{
|
||||
case QtInfoMsg:
|
||||
{
|
||||
QLOG_INFO() << localMsg.constData();
|
||||
break;
|
||||
}
|
||||
case QtDebugMsg:
|
||||
{
|
||||
QLOG_DEBUG() << localMsg.constData();
|
||||
break;
|
||||
}
|
||||
|
||||
case QtWarningMsg:
|
||||
{
|
||||
QLOG_WARN() << localMsg.constData();
|
||||
break;
|
||||
}
|
||||
|
||||
case QtCriticalMsg:
|
||||
{
|
||||
QLOG_ERROR() << localMsg.constData();
|
||||
break;
|
||||
}
|
||||
|
||||
case QtFatalMsg:
|
||||
{
|
||||
QLOG_FATAL() << localMsg.constData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
qInstallMessageHandler(messageHandler);
|
||||
QApplication app( argc, argv );
|
||||
|
||||
#ifdef FORCE_ANGLE
|
||||
|
Reference in New Issue
Block a user