msghandler: Output log context only when not null

remotes/origin/falkon
David Rosca 11 years ago
parent f35f17fa96
commit 6a16cff13e
  1. 13
      src/main/main.cpp

@ -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:

Loading…
Cancel
Save