1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 19:12:11 +01:00

Use qFormatLogMessage in msgHandler

This commit is contained in:
David Rosca 2017-01-20 15:19:18 +01:00
parent a6988ee8f1
commit 9260dd420c

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * QupZilla - Qt web browser
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com> * Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -98,28 +98,21 @@ void qupzilla_signal_handler(int s)
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{ {
if (msg.startsWith(QL1S("QSslSocket: cannot resolve SSLv2_"))) if (msg.startsWith(QL1S("QSslSocket: cannot resolve SSL")))
return; return;
if (msg.startsWith(QL1S("Remote debugging server started successfully."))) if (msg.startsWith(QL1S("Remote debugging server started successfully.")))
return; return;
const QByteArray localMsg = msg.toLocal8Bit();
switch (type) { switch (type) {
case QtDebugMsg: case QtDebugMsg:
case QtInfoMsg:
case QtWarningMsg: case QtWarningMsg:
case QtCriticalMsg: case QtCriticalMsg:
std::cerr << localMsg.constData(); std::cerr << qPrintable(qFormatLogMessage(type, context, msg)) << std::endl;
if (context.file && context.line && context.function)
std::cerr << " (" << context.file << ":" << context.line << ", " << context.function << ")";
std::cerr << std::endl;
break; break;
case QtFatalMsg: case QtFatalMsg:
std::cerr << "Fatal: " << localMsg.constData() << std::endl; std::cerr << "Fatal: " << qPrintable(qFormatLogMessage(type, context, msg)) << std::endl;
if (context.file && context.line && context.function)
std::cerr << " (" << context.file << ":" << context.line << ", " << context.function << ")";
std::cerr << std::endl;
abort(); abort();
default: default: