Switch to QT Category logging (#2206)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Steve Wills
2020-11-21 10:20:10 -05:00
committed by GitHub
parent d206ed4bcc
commit df722a72c1
54 changed files with 655 additions and 239 deletions
+13 -9
View File
@@ -1,6 +1,7 @@
#include "singletons/NativeMessaging.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
#include "singletons/Paths.hpp"
#include "util/PostToThread.hpp"
@@ -125,7 +126,7 @@ void NativeMessagingClient::sendMessage(const QByteArray &array)
}
catch (ipc::interprocess_exception &ex)
{
qDebug() << "send to gui process:" << ex.what();
qCDebug(chatterinoNativeMessage) << "send to gui process:" << ex.what();
}
}
@@ -169,7 +170,8 @@ void NativeMessagingServer::ReceiverThread::run()
}
catch (ipc::interprocess_exception &ex)
{
qDebug() << "received from gui process:" << ex.what();
qCDebug(chatterinoNativeMessage)
<< "received from gui process:" << ex.what();
}
}
}
@@ -183,7 +185,7 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
if (action.isNull())
{
qDebug() << "NM action was null";
qCDebug(chatterinoNativeMessage) << "NM action was null";
return;
}
@@ -203,11 +205,13 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
args.height = root.value("size").toObject().value("height").toInt(-1);
args.fullscreen = attachFullscreen;
qDebug() << args.x << args.width << args.height << args.winId;
qCDebug(chatterinoNativeMessage)
<< args.x << args.width << args.height << args.winId;
if (_type.isNull() || args.winId.isNull())
{
qDebug() << "NM type, name or winId missing";
qCDebug(chatterinoNativeMessage)
<< "NM type, name or winId missing";
attach = false;
attachFullscreen = false;
return;
@@ -242,7 +246,7 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
}
else
{
qDebug() << "NM unknown channel type";
qCDebug(chatterinoNativeMessage) << "NM unknown channel type";
}
}
else if (action == "detach")
@@ -251,20 +255,20 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
if (winId.isNull())
{
qDebug() << "NM winId missing";
qCDebug(chatterinoNativeMessage) << "NM winId missing";
return;
}
#ifdef USEWINSDK
postToThread([winId] {
qDebug() << "NW detach";
qCDebug(chatterinoNativeMessage) << "NW detach";
AttachedWindow::detach(winId);
});
#endif
}
else
{
qDebug() << "NM unknown action " + action;
qCDebug(chatterinoNativeMessage) << "NM unknown action " + action;
}
}
+6 -6
View File
@@ -9,11 +9,11 @@
#include "util/CombinePath.hpp"
#include "util/PostToThread.hpp"
#include <QDebug>
#include <QDesktopServices>
#include <QMessageBox>
#include <QProcess>
#include <QRegularExpression>
#include "common/QLogging.hpp"
namespace chatterino {
namespace {
@@ -59,7 +59,7 @@ Updates::Updates()
: currentVersion_(CHATTERINO_VERSION)
, updateGuideLink_("https://chatterino.com")
{
qDebug() << "init UpdateManager";
qCDebug(chatterinoUpdate) << "init UpdateManager";
}
Updates &Updates::instance()
@@ -234,7 +234,7 @@ void Updates::checkForUpdates()
{
if (!Version::instance().isSupportedOS())
{
qDebug()
qCDebug(chatterinoUpdate)
<< "Update checking disabled because OS doesn't appear to be one "
"of Windows, GNU/Linux or macOS.";
return;
@@ -260,7 +260,7 @@ void Updates::checkForUpdates()
if (!version_val.isString())
{
this->setStatus_(SearchFailed);
qDebug() << "error updating";
qCDebug(chatterinoUpdate) << "error updating";
return Failure;
}
@@ -270,7 +270,7 @@ void Updates::checkForUpdates()
if (!updateExe_val.isString())
{
this->setStatus_(SearchFailed);
qDebug() << "error updating";
qCDebug(chatterinoUpdate) << "error updating";
return Failure;
}
this->updateExe_ = updateExe_val.toString();
@@ -281,7 +281,7 @@ void Updates::checkForUpdates()
if (!portable_val.isString())
{
this->setStatus_(SearchFailed);
qDebug() << "error updating";
qCDebug(chatterinoUpdate) << "error updating";
return Failure;
}
this->updatePortable_ = portable_val.toString();
+4 -3
View File
@@ -13,6 +13,7 @@
#include "Application.hpp"
#include "common/Args.hpp"
#include "common/QLogging.hpp"
#include "debug/AssertInGuiThread.hpp"
#include "messages/MessageElement.hpp"
#include "providers/irc/Irc2.hpp"
@@ -85,7 +86,7 @@ WindowManager::WindowManager()
: windowLayoutFilePath(
combinePath(getPaths()->settingsDirectory, WINDOW_LAYOUT_FILENAME))
{
qDebug() << "init WindowManager";
qCDebug(chatterinoWindowmanager) << "init WindowManager";
auto settings = getSettings();
@@ -270,7 +271,7 @@ Window *WindowManager::windowAt(int index)
{
return nullptr;
}
qDebug() << "getting window at bad index" << index;
qCDebug(chatterinoWindowmanager) << "getting window at bad index" << index;
return this->windows_.at(index);
}
@@ -343,7 +344,7 @@ void WindowManager::save()
{
return;
}
qDebug() << "[WindowManager] Saving";
qCDebug(chatterinoWindowmanager) << "[WindowManager] Saving";
assertInGuiThread();
QJsonDocument document;
+3 -2
View File
@@ -1,6 +1,7 @@
#include "LoggingChannel.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
@@ -63,13 +64,13 @@ void LoggingChannel::openLogFile()
if (!QDir().mkpath(directory))
{
qDebug() << "Unable to create logging path";
qCDebug(chatterinoHelper) << "Unable to create logging path";
return;
}
// Open file handle to log file of current date
QString fileName = directory + QDir::separator() + baseFileName;
qDebug() << "Logging to" << fileName;
qCDebug(chatterinoHelper) << "Logging to" << fileName;
this->fileHandle.setFileName(fileName);
this->fileHandle.open(QIODevice::Append);