1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

msghandler: Output log context only when not null

This commit is contained in:
David Rosca 2015-08-18 10:05:16 +02:00
parent f35f17fa96
commit 6a16cff13e

View File

@ -105,16 +105,23 @@ void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString
if (msg.startsWith(QL1S("QSslSocket: cannot resolve SSLv2_")))
return;
QByteArray localMsg = msg.toLocal8Bit();
const QByteArray localMsg = msg.toLocal8Bit();
switch (type) {
case QtDebugMsg:
case QtWarningMsg:
case QtCriticalMsg:
std::cerr << localMsg.constData() << " (" << context.file << ":" << context.line << ", " << context.function << ")" << std::endl;
std::cerr << localMsg.constData();
if (context.file && context.line && context.function)
std::cerr << " (" << context.file << ":" << context.line << ", " << context.function << ")";
std::cerr << std::endl;
break;
case QtFatalMsg:
std::cerr << "Fatal: " << localMsg.constData() << " (" << context.file << ":" << context.line << ", " << context.function << ")" << std::endl;
std::cerr << "Fatal: " << localMsg.constData() << std::endl;
if (context.file && context.line && context.function)
std::cerr << " (" << context.file << ":" << context.line << ", " << context.function << ")";
std::cerr << std::endl;
abort();
default: