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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 655 additions and 239 deletions

View file

@ -133,6 +133,7 @@ SOURCES += \
src/common/UsernameSet.cpp \
src/common/Version.cpp \
src/common/WindowDescriptors.cpp \
src/common/QLogging.cpp \
src/controllers/accounts/Account.cpp \
src/controllers/accounts/AccountController.cpp \
src/controllers/accounts/AccountModel.cpp \
@ -348,6 +349,7 @@ HEADERS += \
src/common/UniqueAccess.hpp \
src/common/UsernameSet.hpp \
src/common/Version.hpp \
src/common/QLogging.hpp \
src/controllers/accounts/Account.hpp \
src/controllers/accounts/AccountController.hpp \
src/controllers/accounts/AccountModel.hpp \
@ -418,6 +420,7 @@ HEADERS += \
src/providers/IvrApi.hpp \
src/providers/LinkResolver.hpp \
src/providers/twitch/ChannelPointReward.hpp \
src/providers/twitch/ChatterinoWebSocketppLogger.hpp \
src/providers/twitch/api/Helix.hpp \
src/providers/twitch/api/Kraken.hpp \
src/providers/twitch/EmoteValue.hpp \
@ -620,6 +623,7 @@ CONFIG(debug, debug|release) {
message("Building Chatterino2 DEBUG")
} else {
message("Building Chatterino2 RELEASE")
DEFINES += DEBUG_OFF
}
message("Injected git values: $$git_commit ($$git_release) $$git_hash")

View file

@ -3,6 +3,7 @@
#include <atomic>
#include "common/Args.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/commands/CommandController.hpp"
@ -339,7 +340,8 @@ void Application::initPubsub()
}
else
{
qDebug() << "Couldn't find channel id of point reward";
qCDebug(chatterinoApp)
<< "Couldn't find channel id of point reward";
}
});

View file

@ -12,6 +12,7 @@
#include "common/Args.hpp"
#include "common/Modes.hpp"
#include "common/NetworkManager.hpp"
#include "common/QLogging.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Resources.hpp"
#include "singletons/Settings.hpp"
@ -144,7 +145,7 @@ namespace {
// improved in the future.
void clearCache(const QDir &dir)
{
qDebug() << "[Cache] cleared cache";
qCDebug(chatterinoCache) << "[Cache] cleared cache";
QStringList toBeRemoved;

View file

@ -7,6 +7,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QStringList>
#include "common/QLogging.hpp"
namespace chatterino {
@ -38,13 +39,13 @@ Args::Args(const QApplication &app)
if (!parser.parse(app.arguments()))
{
qDebug() << "Warning: Unhandled options:"
<< parser.unknownOptionNames();
qCWarning(chatterinoArgs)
<< "Unhandled options:" << parser.unknownOptionNames();
}
if (parser.isSet("help"))
{
qDebug().noquote() << parser.helpText();
qCInfo(chatterinoArgs).noquote() << parser.helpText();
::exit(EXIT_SUCCESS);
}

View file

@ -3,6 +3,7 @@
#include "singletons/Paths.hpp"
#include <QDesktopServices>
#include "common/QLogging.hpp"
namespace chatterino {
@ -40,7 +41,8 @@ void DownloadManager::setFile(QString fileURL, const QString &channelName)
void DownloadManager::onDownloadProgress(qint64 bytesRead, qint64 bytesTotal)
{
qDebug() << "Download progress: " << bytesRead << "/" << bytesTotal;
qCDebug(chatterinoCommon)
<< "Download progress: " << bytesRead << "/" << bytesTotal;
}
void DownloadManager::onFinished(QNetworkReply *reply)
@ -48,11 +50,11 @@ void DownloadManager::onFinished(QNetworkReply *reply)
switch (reply->error())
{
case QNetworkReply::NoError: {
qDebug("file is downloaded successfully.");
qCDebug(chatterinoCommon) << "file is downloaded successfully.";
}
break;
default: {
qDebug() << reply->errorString().toLatin1();
qCDebug(chatterinoCommon) << reply->errorString().toLatin1();
};
}

View file

@ -11,6 +11,7 @@
#include <QCryptographicHash>
#include <QFile>
#include <QtConcurrent>
#include "common/QLogging.hpp"
namespace chatterino {
@ -123,7 +124,7 @@ void loadUncached(const std::shared_ptr<NetworkData> &data)
if (reply == nullptr)
{
qDebug() << "Unhandled request type";
qCDebug(chatterinoCommon) << "Unhandled request type";
return;
}
@ -131,7 +132,7 @@ void loadUncached(const std::shared_ptr<NetworkData> &data)
{
QObject::connect(
data->timer_, &QTimer::timeout, worker, [reply, data]() {
qDebug() << "Aborted!";
qCDebug(chatterinoCommon) << "Aborted!";
reply->abort();
if (data->onError_)
{

View file

@ -12,6 +12,7 @@
#include <QDebug>
#include <QFile>
#include <QtConcurrent>
#include "common/QLogging.hpp"
#include <cassert>
@ -167,7 +168,7 @@ void NetworkRequest::execute()
if (this->data->cache_ &&
this->data->requestType_ != NetworkRequestType::Get)
{
qDebug() << "Can only cache GET requests!";
qCDebug(chatterinoCommon) << "Can only cache GET requests!";
this->data->cache_ = false;
}

View file

@ -3,6 +3,7 @@
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
#include <QJsonDocument>
#include "common/QLogging.hpp"
namespace chatterino {
@ -43,9 +44,9 @@ rapidjson::Document NetworkResult::parseRapidJson() const
if (result.Code() != rapidjson::kParseErrorNone)
{
qDebug() << "JSON parse error:"
<< rapidjson::GetParseError_En(result.Code()) << "("
<< result.Offset() << ")";
qCWarning(chatterinoCommon)
<< "JSON parse error:" << rapidjson::GetParseError_En(result.Code())
<< "(" << result.Offset() << ")";
return ret;
}

37
src/common/QLogging.cpp Normal file
View file

@ -0,0 +1,37 @@
#include "common/QLogging.hpp"
#ifdef DEBUG_OFF
static constexpr QtMsgType logThreshold = QtWarningMsg;
#else
static constexpr QtMsgType logThreshold = QtDebugMsg;
#endif
Q_LOGGING_CATEGORY(chatterinoApp, "chatterino.app", logThreshold);
Q_LOGGING_CATEGORY(chatterinoArgs, "chatterino.args", logThreshold);
Q_LOGGING_CATEGORY(chatterinoBenchmark, "chatterino.benchmark", logThreshold);
Q_LOGGING_CATEGORY(chatterinoBttv, "chatterino.bttv", logThreshold);
Q_LOGGING_CATEGORY(chatterinoCommon, "chatterino.cache", logThreshold);
Q_LOGGING_CATEGORY(chatterinoCache, "chatterino.common", logThreshold);
Q_LOGGING_CATEGORY(chatterinoEmoji, "chatterino.emoji", logThreshold);
Q_LOGGING_CATEGORY(chatterinoFfzemotes, "chatterino.ffzemotes", logThreshold);
Q_LOGGING_CATEGORY(chatterinoHelper, "chatterino.helper", logThreshold);
Q_LOGGING_CATEGORY(chatterinoImage, "chatterino.image", logThreshold);
Q_LOGGING_CATEGORY(chatterinoIrc, "chatterino.irc", logThreshold);
Q_LOGGING_CATEGORY(chatterinoIvr, "chatterino.ivr", logThreshold);
Q_LOGGING_CATEGORY(chatterinoMain, "chatterino.main", logThreshold);
Q_LOGGING_CATEGORY(chatterinoMessage, "chatterino.message", logThreshold);
Q_LOGGING_CATEGORY(chatterinoNativeMessage, "chatterino.nativemessage",
logThreshold);
Q_LOGGING_CATEGORY(chatterinoNotification, "chatterino.notification",
logThreshold);
Q_LOGGING_CATEGORY(chatterinoNuulsuploader, "chatterino.nuulsuploader",
logThreshold);
Q_LOGGING_CATEGORY(chatterinoPubsub, "chatterino.pubsub", logThreshold);
Q_LOGGING_CATEGORY(chatterinoStreamlink, "chatterino.streamlink", logThreshold);
Q_LOGGING_CATEGORY(chatterinoTokenizer, "chatterino.tokenizer", logThreshold);
Q_LOGGING_CATEGORY(chatterinoTwitch, "chatterino.twitch", logThreshold);
Q_LOGGING_CATEGORY(chatterinoUpdate, "chatterino.update", logThreshold);
Q_LOGGING_CATEGORY(chatterinoWebsocket, "chatterino.websocket", logThreshold);
Q_LOGGING_CATEGORY(chatterinoWidget, "chatterino.widget", logThreshold);
Q_LOGGING_CATEGORY(chatterinoWindowmanager, "chatterino.windowmanager",
logThreshold);

29
src/common/QLogging.hpp Normal file
View file

@ -0,0 +1,29 @@
#pragma once
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(chatterinoApp);
Q_DECLARE_LOGGING_CATEGORY(chatterinoArgs);
Q_DECLARE_LOGGING_CATEGORY(chatterinoBenchmark);
Q_DECLARE_LOGGING_CATEGORY(chatterinoBttv);
Q_DECLARE_LOGGING_CATEGORY(chatterinoCache);
Q_DECLARE_LOGGING_CATEGORY(chatterinoCommon);
Q_DECLARE_LOGGING_CATEGORY(chatterinoEmoji);
Q_DECLARE_LOGGING_CATEGORY(chatterinoFfzemotes);
Q_DECLARE_LOGGING_CATEGORY(chatterinoHelper);
Q_DECLARE_LOGGING_CATEGORY(chatterinoImage);
Q_DECLARE_LOGGING_CATEGORY(chatterinoIrc);
Q_DECLARE_LOGGING_CATEGORY(chatterinoIvr);
Q_DECLARE_LOGGING_CATEGORY(chatterinoMain);
Q_DECLARE_LOGGING_CATEGORY(chatterinoMessage);
Q_DECLARE_LOGGING_CATEGORY(chatterinoNativeMessage);
Q_DECLARE_LOGGING_CATEGORY(chatterinoNotification);
Q_DECLARE_LOGGING_CATEGORY(chatterinoNuulsuploader);
Q_DECLARE_LOGGING_CATEGORY(chatterinoPubsub);
Q_DECLARE_LOGGING_CATEGORY(chatterinoStreamlink);
Q_DECLARE_LOGGING_CATEGORY(chatterinoTokenizer);
Q_DECLARE_LOGGING_CATEGORY(chatterinoTwitch);
Q_DECLARE_LOGGING_CATEGORY(chatterinoUpdate);
Q_DECLARE_LOGGING_CATEGORY(chatterinoWebsocket);
Q_DECLARE_LOGGING_CATEGORY(chatterinoWidget);
Q_DECLARE_LOGGING_CATEGORY(chatterinoWindowmanager);

View file

@ -1,5 +1,6 @@
#include "common/WindowDescriptors.hpp"
#include "common/QLogging.hpp"
#include "widgets/Window.hpp"
namespace chatterino {
@ -126,7 +127,7 @@ WindowLayout WindowLayout::loadFromFile(const QString &path)
{
if (hasSetAMainWindow)
{
qDebug()
qCDebug(chatterinoCommon)
<< "Window Layout file contains more than one Main window "
"- demoting to Popup type";
type = WindowType::Popup;
@ -180,7 +181,8 @@ WindowLayout WindowLayout::loadFromFile(const QString &path)
{
if (hasSetASelectedTab)
{
qDebug() << "Window contains more than one selected tab - "
qCDebug(chatterinoCommon)
<< "Window contains more than one selected tab - "
"demoting to unselected";
tab.selected_ = false;
}

View file

@ -1,4 +1,5 @@
#include "controllers/filters/parser/Tokenizer.hpp"
#include "common/QLogging.hpp"
namespace filterparser {
@ -70,21 +71,24 @@ void Tokenizer::debug()
{
if (this->i_ > 0)
{
qDebug() << "= current" << this->tokens_.at(this->i_ - 1);
qDebug() << "= current type" << this->tokenTypes_.at(this->i_ - 1);
qCDebug(chatterinoTokenizer)
<< "= current" << this->tokens_.at(this->i_ - 1);
qCDebug(chatterinoTokenizer)
<< "= current type" << this->tokenTypes_.at(this->i_ - 1);
}
else
{
qDebug() << "= no current";
qCDebug(chatterinoTokenizer) << "= no current";
}
if (this->hasNext())
{
qDebug() << "= next" << this->tokens_.at(this->i_);
qDebug() << "= next type" << this->tokenTypes_.at(this->i_);
qCDebug(chatterinoTokenizer) << "= next" << this->tokens_.at(this->i_);
qCDebug(chatterinoTokenizer)
<< "= next type" << this->tokenTypes_.at(this->i_);
}
else
{
qDebug() << "= no next";
qCDebug(chatterinoTokenizer) << "= no next";
}
}

View file

@ -3,6 +3,7 @@
#include "Application.hpp"
#include "common/NetworkRequest.hpp"
#include "common/Outcome.hpp"
#include "common/QLogging.hpp"
#include "controllers/notifications/NotificationModel.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
#include "providers/twitch/api/Helix.hpp"
@ -146,7 +147,7 @@ void NotificationController::getFakeTwitchChannelLiveStatus(
getHelix()->getStreamByName(
channelName,
[channelName, this](bool live, const auto &stream) {
qDebug() << "[TwitchChannel" << channelName
qCDebug(chatterinoNotification) << "[TwitchChannel" << channelName
<< "] Refreshing live status";
if (!live)
@ -185,7 +186,8 @@ void NotificationController::getFakeTwitchChannelLiveStatus(
fakeTwitchChannels.push_back(channelName);
},
[channelName, this] {
qDebug() << "[TwitchChannel" << channelName
qCDebug(chatterinoNotification)
<< "[TwitchChannel" << channelName
<< "] Refreshing live status (Missing ID)";
this->removeFakeChannel(channelName);
});

View file

@ -1,4 +1,5 @@
#include "Benchmark.hpp"
#include "common/QLogging.hpp"
namespace chatterino {
@ -10,8 +11,8 @@ BenchmarkGuard::BenchmarkGuard(const QString &_name)
BenchmarkGuard::~BenchmarkGuard()
{
qDebug() << this->name_ << float(timer_.nsecsElapsed()) / 1000000.0f
<< "ms";
qCDebug(chatterinoBenchmark)
<< this->name_ << float(timer_.nsecsElapsed()) / 1000000.0f << "ms";
}
qreal BenchmarkGuard::getElapsedMs()

View file

@ -1,6 +1,5 @@
#pragma once
#include <QDebug>
#include <QElapsedTimer>
#include <boost/noncopyable.hpp>

View file

@ -1,6 +1,5 @@
#include <QApplication>
#include <QCommandLineParser>
#include <QDebug>
#include <QMessageBox>
#include <QStringList>
#include <memory>
@ -9,6 +8,7 @@
#include "RunGui.hpp"
#include "common/Args.hpp"
#include "common/Modes.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "providers/IvrApi.hpp"
#include "providers/twitch/api/Helix.hpp"
@ -37,7 +37,8 @@ int main(int argc, char **argv)
else if (getArgs().printVersion)
{
auto version = Version::instance();
qInfo().noquote() << QString("%1 (commit %2%3)")
qCInfo(chatterinoMain).noquote()
<< QString("%1 (commit %2%3)")
.arg(version.fullVersion())
.arg(version.commitHash())
.arg(Modes::instance().isNightly

View file

@ -12,6 +12,7 @@
#include "Application.hpp"
#include "common/Common.hpp"
#include "common/NetworkRequest.hpp"
#include "common/QLogging.hpp"
#include "debug/AssertInGuiThread.hpp"
#include "debug/Benchmark.hpp"
#include "singletons/Emotes.hpp"
@ -130,7 +131,8 @@ namespace detail {
if (reader.imageCount() == 0)
{
qDebug() << "Error while reading image" << url.string << ": '"
qCDebug(chatterinoImage)
<< "Error while reading image" << url.string << ": '"
<< reader.errorString() << "'";
return frames;
}
@ -149,7 +151,8 @@ namespace detail {
if (frames.size() == 0)
{
qDebug() << "Error while reading image" << url.string << ": '"
qCDebug(chatterinoImage)
<< "Error while reading image" << url.string << ": '"
<< reader.errorString() << "'";
}

View file

@ -1,6 +1,7 @@
#include "messages/SharedMessageBuilder.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "controllers/ignores/IgnorePhrase.hpp"
#include "messages/Message.hpp"
#include "messages/MessageElement.hpp"
@ -88,7 +89,8 @@ bool SharedMessageBuilder::isIgnored() const
{
if (phrase.isBlock() && phrase.isMatch(this->originalMessage_))
{
qDebug() << "Blocking message because it contains ignored phrase"
qCDebug(chatterinoMessage)
<< "Blocking message because it contains ignored phrase"
<< phrase.getPattern();
return true;
}
@ -202,7 +204,8 @@ void SharedMessageBuilder::parseHighlights()
{
continue;
}
qDebug() << "Highlight because user" << this->ircMessage->nick()
qCDebug(chatterinoMessage)
<< "Highlight because user" << this->ircMessage->nick()
<< "sent a message";
this->message().flags.set(MessageFlag::Highlighted);

View file

@ -1,6 +1,7 @@
#include "messages/layouts/MessageLayoutElement.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "messages/Emote.hpp"
#include "messages/Image.hpp"
#include "messages/MessageElement.hpp"
@ -422,7 +423,7 @@ void MultiColorTextLayoutElement::paint(QPainter &painter)
for (const auto &segment : this->segments_)
{
// qDebug() << "Draw segment:" << segment.text;
qCDebug(chatterinoMessage) << "Draw segment:" << segment.text;
painter.setPen(segment.color);
painter.drawText(QRectF(this->getRect().x() + xOffset,
this->getRect().y(), 10000, 10000),

View file

@ -1,6 +1,7 @@
#include "IvrApi.hpp"
#include "common/Outcome.hpp"
#include "common/QLogging.hpp"
#include <QUrlQuery>
@ -23,7 +24,8 @@ void IvrApi::getSubage(QString userName, QString channelName,
return Success;
})
.onError([failureCallback](NetworkResult result) {
qDebug() << "Failed IVR API Call!" << result.status()
qCWarning(chatterinoIvr)
<< "Failed IVR API Call!" << result.status()
<< QString(result.getData());
failureCallback();
})

View file

@ -5,6 +5,7 @@
#include "common/Common.hpp"
#include "common/NetworkRequest.hpp"
#include "common/QLogging.hpp"
#include "messages/Emote.hpp"
#include "messages/Image.hpp"
#include "messages/ImageSet.hpp"
@ -178,15 +179,17 @@ void BttvEmotes::loadChannel(std::weak_ptr<Channel> channel,
else if (result.status() == NetworkResult::timedoutStatus)
{
// TODO: Auto retry in case of a timeout, with a delay
qDebug() << "Fetching BTTV emotes for channel" << channelId
qCWarning(chatterinoBttv)
<< "Fetching BTTV emotes for channel" << channelId
<< "failed due to timeout";
shared->addMessage(makeSystemMessage(
"Failed to fetch BetterTTV channel emotes. (timed out)"));
}
else
{
qDebug() << "Error fetching BTTV emotes for channel"
<< channelId << ", error" << result.status();
qCWarning(chatterinoBttv)
<< "Error fetching BTTV emotes for channel" << channelId
<< ", error" << result.status();
shared->addMessage(
makeSystemMessage("Failed to fetch BetterTTV channel "
"emotes. (unknown error)"));

View file

@ -10,6 +10,7 @@
#include <QFile>
#include <boost/variant.hpp>
#include <memory>
#include "common/QLogging.hpp"
namespace chatterino {
namespace {
@ -131,9 +132,9 @@ void Emojis::loadEmojis()
if (result.Code() != rapidjson::kParseErrorNone)
{
qDebug() << "JSON parse error:"
<< rapidjson::GetParseError_En(result.Code()) << "("
<< result.Offset() << ")";
qCWarning(chatterinoEmoji)
<< "JSON parse error:" << rapidjson::GetParseError_En(result.Code())
<< "(" << result.Offset() << ")";
return;
}
@ -165,7 +166,8 @@ void Emojis::loadEmojis()
auto toneNameIt = toneNames.find(tone);
if (toneNameIt == toneNames.end())
{
qDebug() << "Tone with key" << tone.c_str()
qCDebug(chatterinoEmoji)
<< "Tone with key" << tone.c_str()
<< "does not exist in tone names map";
continue;
}

View file

@ -4,6 +4,7 @@
#include "common/NetworkRequest.hpp"
#include "common/Outcome.hpp"
#include "common/QLogging.hpp"
#include "messages/Emote.hpp"
#include "messages/Image.hpp"
#include "messages/MessageBuilder.hpp"
@ -195,8 +196,8 @@ void FfzEmotes::loadChannel(
std::function<void(boost::optional<EmotePtr>)> modBadgeCallback,
bool manualRefresh)
{
qDebug() << "[FFZEmotes] Reload FFZ Channel Emotes for channel"
<< channelId;
qCDebug(chatterinoFfzemotes)
<< "[FFZEmotes] Reload FFZ Channel Emotes for channel" << channelId;
NetworkRequest("https://api.frankerfacez.com/v1/room/id/" + channelId)
@ -230,7 +231,8 @@ void FfzEmotes::loadChannel(
else if (result.status() == NetworkResult::timedoutStatus)
{
// TODO: Auto retry in case of a timeout, with a delay
qDebug() << "Fetching FFZ emotes for channel" << channelId
qCWarning(chatterinoFfzemotes)
<< "Fetching FFZ emotes for channel" << channelId
<< "failed due to timeout";
shared->addMessage(
makeSystemMessage("Failed to fetch FrankerFaceZ channel "
@ -238,7 +240,8 @@ void FfzEmotes::loadChannel(
}
else
{
qDebug() << "Error fetching FFZ emotes for channel" << channelId
qCWarning(chatterinoFfzemotes)
<< "Error fetching FFZ emotes for channel" << channelId
<< ", error" << result.status();
shared->addMessage(
makeSystemMessage("Failed to fetch FrankerFaceZ channel "

View file

@ -2,6 +2,7 @@
#include "common/Channel.hpp"
#include "common/Common.hpp"
#include "common/QLogging.hpp"
#include "messages/LimitedQueueSnapshot.hpp"
#include "messages/Message.hpp"
#include "messages/MessageBuilder.hpp"
@ -76,7 +77,8 @@ AbstractIrcServer::AbstractIrcServer()
if (!this->readConnection_->isConnected())
{
qDebug() << "Trying to reconnect..." << this->falloffCounter_;
qCDebug(chatterinoIrc)
<< "Trying to reconnect..." << this->falloffCounter_;
this->connect();
}
});
@ -195,8 +197,8 @@ ChannelPtr AbstractIrcServer::getOrAddChannel(const QString &dirtyChannelName)
chan->destroyed.connect([this, channelName] {
// fourtf: issues when the server itself is destroyed
qDebug() << "[AbstractIrcServer::addChannel]" << channelName
<< "was destroyed";
qCDebug(chatterinoIrc) << "[AbstractIrcServer::addChannel]"
<< channelName << "was destroyed";
this->channels.remove(channelName);
if (this->readConnection_)

View file

@ -3,6 +3,7 @@
#include <cassert>
#include <cstdlib>
#include "common/QLogging.hpp"
#include "messages/Message.hpp"
#include "providers/irc/Irc2.hpp"
#include "providers/irc/IrcChannel2.hpp"
@ -187,7 +188,7 @@ void IrcServer::privateMessageReceived(Communi::IrcPrivateMessage *message)
}
else
{
qDebug() << "message ignored :rage:";
qCDebug(chatterinoIrc) << "message ignored :rage:";
}
}
}

View file

@ -1,4 +1,5 @@
#include "ChannelPointReward.hpp"
#include "common/QLogging.hpp"
#include "util/RapidjsonHelpers.hpp"
namespace chatterino {
@ -9,7 +10,8 @@ QString parseRewardImage(const rapidjson::Value &obj, const char *key,
QString url;
if (!(result = rj::getSafe(obj, key, url)))
{
qDebug() << "No url value found for key in reward image object:" << key;
qCDebug(chatterinoTwitch)
<< "No url value found for key in reward image object:" << key;
return "";
}
@ -22,7 +24,7 @@ ChannelPointReward::ChannelPointReward(rapidjson::Value &redemption)
if (!(this->hasParsedSuccessfully =
rj::getSafeObject(redemption, "user", user)))
{
qDebug() << "No user info found for redemption";
qCDebug(chatterinoTwitch) << "No user info found for redemption";
return;
}
@ -30,41 +32,42 @@ ChannelPointReward::ChannelPointReward(rapidjson::Value &redemption)
if (!(this->hasParsedSuccessfully =
rj::getSafeObject(redemption, "reward", reward)))
{
qDebug() << "No reward info found for redemption";
qCDebug(chatterinoTwitch) << "No reward info found for redemption";
return;
}
if (!(this->hasParsedSuccessfully = rj::getSafe(reward, "id", this->id)))
{
qDebug() << "No id found for reward";
qCDebug(chatterinoTwitch) << "No id found for reward";
return;
}
if (!(this->hasParsedSuccessfully =
rj::getSafe(reward, "channel_id", this->channelId)))
{
qDebug() << "No channel_id found for reward";
qCDebug(chatterinoTwitch) << "No channel_id found for reward";
return;
}
if (!(this->hasParsedSuccessfully =
rj::getSafe(reward, "title", this->title)))
{
qDebug() << "No title found for reward";
qCDebug(chatterinoTwitch) << "No title found for reward";
return;
}
if (!(this->hasParsedSuccessfully =
rj::getSafe(reward, "cost", this->cost)))
{
qDebug() << "No cost found for reward";
qCDebug(chatterinoTwitch) << "No cost found for reward";
return;
}
if (!(this->hasParsedSuccessfully = rj::getSafe(
reward, "is_user_input_required", this->isUserInputRequired)))
{
qDebug() << "No information if user input is required found for reward";
qCDebug(chatterinoTwitch)
<< "No information if user input is required found for reward";
return;
}
@ -105,21 +108,21 @@ void ChannelPointReward::parseUser(rapidjson::Value &user)
{
if (!(this->hasParsedSuccessfully = rj::getSafe(user, "id", this->user.id)))
{
qDebug() << "No id found for user in reward";
qCDebug(chatterinoTwitch) << "No id found for user in reward";
return;
}
if (!(this->hasParsedSuccessfully =
rj::getSafe(user, "login", this->user.login)))
{
qDebug() << "No login name found for user in reward";
qCDebug(chatterinoTwitch) << "No login name found for user in reward";
return;
}
if (!(this->hasParsedSuccessfully =
rj::getSafe(user, "display_name", this->user.displayName)))
{
qDebug() << "No display name found for user in reward";
qCDebug(chatterinoTwitch) << "No display name found for user in reward";
return;
}
}

View file

@ -0,0 +1,199 @@
/*
* Copyright (c) 2020, Peter Thorson, Steve Wills. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the WebSocket++ Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef CHATTERINOWEBSOCKETPPLOGGER_HPP
#define CHATTERINOWEBSOCKETPPLOGGER_HPP
#include <string>
#include <websocketpp/common/cpp11.hpp>
#include <websocketpp/logger/basic.hpp>
#include <websocketpp/logger/levels.hpp>
#include "common/QLogging.hpp"
namespace websocketpp {
namespace log {
template <typename concurrency, typename names>
class chatterinowebsocketpplogger : public basic<concurrency, names>
{
public:
typedef chatterinowebsocketpplogger<concurrency, names> base;
chatterinowebsocketpplogger<concurrency, names>(
channel_type_hint::value)
: m_static_channels(0xffffffff)
, m_dynamic_channels(0)
{
}
chatterinowebsocketpplogger<concurrency, names>(std::ostream *)
: m_static_channels(0xffffffff)
, m_dynamic_channels(0)
{
}
chatterinowebsocketpplogger<concurrency, names>(
level c, channel_type_hint::value)
: m_static_channels(c)
, m_dynamic_channels(0)
{
}
chatterinowebsocketpplogger<concurrency, names>(level c, std::ostream *)
: m_static_channels(c)
, m_dynamic_channels(0)
{
}
~chatterinowebsocketpplogger<concurrency, names>()
{
}
chatterinowebsocketpplogger<concurrency, names>(
chatterinowebsocketpplogger<concurrency, names> const &other)
: m_static_channels(other.m_static_channels)
, m_dynamic_channels(other.m_dynamic_channels)
{
}
#ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
chatterinowebsocketpplogger<concurrency, names> &operator=(
chatterinowebsocketpplogger<concurrency, names> const &) = delete;
#endif // _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
#ifdef _WEBSOCKETPP_MOVE_SEMANTICS_
/// Move constructor
chatterinowebsocketpplogger<concurrency, names>(
chatterinowebsocketpplogger<concurrency, names> &&other)
: m_static_channels(other.m_static_channels)
, m_dynamic_channels(other.m_dynamic_channels)
{
}
# ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
// no move assignment operator because of const member variables
chatterinowebsocketpplogger<concurrency, names> &operator=(
chatterinowebsocketpplogger<concurrency, names> &&) = delete;
# endif // _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
#endif // _WEBSOCKETPP_MOVE_SEMANTICS_
/// Explicitly do nothing, this logger doesn't support changing ostream
void set_ostream(std::ostream *)
{
}
/// Dynamically enable the given list of channels
/**
* @param channels The package of channels to enable
*/
void set_channels(level channels)
{
if (channels == names::none)
{
clear_channels(names::all);
return;
}
scoped_lock_type lock(m_lock);
m_dynamic_channels |= (channels & m_static_channels);
}
/// Dynamically disable the given list of channels
/**
* @param channels The package of channels to disable
*/
void clear_channels(level channels)
{
scoped_lock_type lock(m_lock);
m_dynamic_channels &= ~channels;
}
/// Write a string message to the given channel
/**
* @param channel The channel to write to
* @param msg The message to write
*/
void write(level channel, std::string const &msg)
{
scoped_lock_type lock(m_lock);
if (!this->dynamic_test(channel))
{
return;
}
qCDebug(chatterinoWebsocket).nospace()
<< names::channel_name(channel) << ": "
<< QString::fromStdString(msg);
}
/// Write a cstring message to the given channel
/**
* @param channel The channel to write to
* @param msg The message to write
*/
void write(level channel, char const *msg)
{
scoped_lock_type lock(m_lock);
if (!this->dynamic_test(channel))
{
return;
}
qCDebug(chatterinoWebsocket).nospace()
<< names::channel_name(channel) << ": " << msg;
}
/// Test whether a channel is statically enabled
/**
* @param channel The package of channels to test
*/
_WEBSOCKETPP_CONSTEXPR_TOKEN_ bool static_test(level channel) const
{
return ((channel & m_static_channels) != 0);
}
/// Test whether a channel is dynamically enabled
/**
* @param channel The package of channels to test
*/
bool dynamic_test(level channel)
{
return ((channel & m_dynamic_channels) != 0);
}
protected:
typedef typename concurrency::scoped_lock_type scoped_lock_type;
typedef typename concurrency::mutex_type mutex_type;
mutex_type m_lock;
private:
level const m_static_channels;
level m_dynamic_channels;
};
} // namespace log
} // namespace websocketpp
#endif // CHATTERINOWEBSOCKETPPLOGGER_HPP

View file

@ -1,6 +1,7 @@
#include "IrcMessageHandler.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "messages/LimitedQueue.hpp"
#include "messages/Message.hpp"
@ -361,7 +362,8 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
if (chan->isEmpty())
{
qDebug() << "[IrcMessageHandler:handleClearChatMessage] Twitch channel"
qCDebug(chatterinoTwitch)
<< "[IrcMessageHandler:handleClearChatMessage] Twitch channel"
<< chanName << "not found";
return;
}
@ -427,7 +429,8 @@ void IrcMessageHandler::handleClearMessageMessage(Communi::IrcMessage *message)
if (chan->isEmpty())
{
qDebug() << "[IrcMessageHandler:handleClearMessageMessage] Twitch "
qCDebug(chatterinoTwitch)
<< "[IrcMessageHandler:handleClearMessageMessage] Twitch "
"channel"
<< chanName << "not found";
return;
@ -712,8 +715,9 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
if (channel->isEmpty())
{
qDebug() << "[IrcManager:handleNoticeMessage] Channel"
<< channelName << "not found in channel manager";
qCDebug(chatterinoTwitch)
<< "[IrcManager:handleNoticeMessage] Channel" << channelName
<< "not found in channel manager";
return;
}

View file

@ -8,7 +8,9 @@
#include <rapidjson/error/en.h>
#include <exception>
#include <iostream>
#include <thread>
#include "common/QLogging.hpp"
#define TWITCH_PUBSUB_URL "wss://pubsub-edge.twitch.tv"
@ -154,7 +156,8 @@ namespace detail {
if (self->awaitingPong_)
{
qDebug() << "No pong response, disconnect!";
qCDebug(chatterinoPubsub)
<< "No pong response, disconnect!";
// TODO(pajlada): Label this connection as "disconnect me"
}
});
@ -178,8 +181,8 @@ namespace detail {
if (ec)
{
qDebug() << "Error sending message" << payload << ":"
<< ec.message().c_str();
qCDebug(chatterinoPubsub) << "Error sending message" << payload
<< ":" << ec.message().c_str();
// TODO(pajlada): Check which error code happened and maybe
// gracefully handle it
@ -193,7 +196,7 @@ namespace detail {
PubSub::PubSub()
{
qDebug() << "init PubSub";
qCDebug(chatterinoPubsub) << "init PubSub";
this->moderationActionHandlers["clear"] = [this](const auto &data,
const auto &roomID) {
@ -221,7 +224,7 @@ PubSub::PubSub()
if (!data.HasMember("args"))
{
qDebug() << "Missing required args member";
qCDebug(chatterinoPubsub) << "Missing required args member";
return;
}
@ -229,13 +232,14 @@ PubSub::PubSub()
if (!args.IsArray())
{
qDebug() << "args member must be an array";
qCDebug(chatterinoPubsub) << "args member must be an array";
return;
}
if (args.Size() == 0)
{
qDebug() << "Missing duration argument in slowmode on";
qCDebug(chatterinoPubsub)
<< "Missing duration argument in slowmode on";
return;
}
@ -243,7 +247,7 @@ PubSub::PubSub()
if (!durationArg.IsString())
{
qDebug() << "Duration arg must be a string";
qCDebug(chatterinoPubsub) << "Duration arg must be a string";
return;
}
@ -336,7 +340,8 @@ PubSub::PubSub()
}
catch (const std::runtime_error &ex)
{
qDebug() << "Error parsing moderation action:" << ex.what();
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action:" << ex.what();
}
action.modded = false;
@ -359,7 +364,8 @@ PubSub::PubSub()
if (!getTargetUser(data, action.target))
{
qDebug() << "Error parsing moderation action mod: Unable to get "
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action mod: Unable to get "
"target_user_id";
return;
}
@ -367,7 +373,8 @@ PubSub::PubSub()
// Load target name from message.data.target_user_login
if (!getTargetUserName(data, action.target))
{
qDebug() << "Error parsing moderation action mod: Unable to get "
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action mod: Unable to get "
"target_user_name";
return;
}
@ -416,7 +423,8 @@ PubSub::PubSub()
}
catch (const std::runtime_error &ex)
{
qDebug() << "Error parsing moderation action:" << ex.what();
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action:" << ex.what();
}
};
@ -453,7 +461,8 @@ PubSub::PubSub()
}
catch (const std::runtime_error &ex)
{
qDebug() << "Error parsing moderation action:" << ex.what();
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action:" << ex.what();
}
};
@ -484,7 +493,8 @@ PubSub::PubSub()
}
catch (const std::runtime_error &ex)
{
qDebug() << "Error parsing moderation action:" << ex.what();
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action:" << ex.what();
}
};
@ -515,7 +525,8 @@ PubSub::PubSub()
}
catch (const std::runtime_error &ex)
{
qDebug() << "Error parsing moderation action:" << ex.what();
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action:" << ex.what();
}
};
@ -567,7 +578,8 @@ PubSub::PubSub()
}
catch (const std::runtime_error &ex)
{
qDebug() << "Error parsing moderation action:" << ex.what();
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action:" << ex.what();
}
};
@ -596,7 +608,8 @@ PubSub::PubSub()
}
catch (const std::runtime_error &ex)
{
qDebug() << "Error parsing moderation action:" << ex.what();
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action:" << ex.what();
}
};
@ -625,7 +638,8 @@ PubSub::PubSub()
}
catch (const std::runtime_error &ex)
{
qDebug() << "Error parsing moderation action:" << ex.what();
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action:" << ex.what();
}
};
@ -654,7 +668,8 @@ PubSub::PubSub()
}
catch (const std::runtime_error &ex)
{
qDebug() << "Error parsing moderation action:" << ex.what();
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action:" << ex.what();
}
};
@ -684,7 +699,8 @@ PubSub::PubSub()
}
catch (const std::runtime_error &ex)
{
qDebug() << "Error parsing moderation action:" << ex.what();
qCDebug(chatterinoPubsub)
<< "Error parsing moderation action:" << ex.what();
}
};
@ -697,16 +713,19 @@ PubSub::PubSub()
this->signals_.moderation.automodUserMessage.invoke(action);
};
this->moderationActionHandlers["denied_automod_message"] =
[](const auto &data, const auto &roomID) {
this->moderationActionHandlers["denied_automod_message"] = [](const auto
&data,
const auto
&roomID) {
// This message got denied by a moderator
// qDebug() << QString::fromStdString(rj::stringify(data));
// qCDebug(chatterinoPubsub) << QString::fromStdString(rj::stringify(data));
};
this->moderationActionHandlers["approved_automod_message"] =
[](const auto &data, const auto &roomID) {
this->moderationActionHandlers
["approved_automod_message"] = [](const auto &data,
const auto &roomID) {
// This message got approved by a moderator
// qDebug() << QString::fromStdString(rj::stringify(data));
// qCDebug(chatterinoPubsub) << QString::fromStdString(rj::stringify(data));
};
this->websocketClient.set_access_channels(websocketpp::log::alevel::all);
@ -737,7 +756,8 @@ void PubSub::addClient()
if (ec)
{
qDebug() << "Unable to establish connection:" << ec.message().c_str();
qCDebug(chatterinoPubsub)
<< "Unable to establish connection:" << ec.message().c_str();
return;
}
@ -758,7 +778,7 @@ void PubSub::listenToWhispers(std::shared_ptr<TwitchAccount> account)
auto userID = account->getUserId();
qDebug() << "Connection open!";
qCDebug(chatterinoPubsub) << "Connection open!";
websocketpp::lib::error_code ec;
std::vector<QString> topics({topicFormat.arg(userID)});
@ -767,7 +787,8 @@ void PubSub::listenToWhispers(std::shared_ptr<TwitchAccount> account)
if (ec)
{
qDebug() << "Unable to send message to websocket server:"
qCDebug(chatterinoPubsub)
<< "Unable to send message to websocket server:"
<< ec.message().c_str();
return;
}
@ -799,7 +820,7 @@ void PubSub::listenToChannelModerationActions(
return;
}
qDebug() << "Listen to topic" << topic;
qCDebug(chatterinoPubsub) << "Listen to topic" << topic;
this->listenToTopic(topic, account);
}
@ -818,8 +839,7 @@ void PubSub::listenToChannelPointRewards(const QString &channelID,
{
return;
}
qDebug() << "Listen to topic" << topic;
qCDebug(chatterinoPubsub) << "Listen to topic" << topic;
this->listenToTopic(topic, account);
}
@ -884,14 +904,16 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
if (!res)
{
qDebug() << "Error parsing message '" << payload.c_str()
qCDebug(chatterinoPubsub)
<< "Error parsing message '" << payload.c_str()
<< "' from PubSub:" << rapidjson::GetParseError_En(res.Code());
return;
}
if (!msg.IsObject())
{
qDebug() << "Error parsing message '" << payload.c_str()
qCDebug(chatterinoPubsub)
<< "Error parsing message '" << payload.c_str()
<< "' from PubSub. Root object is not an "
"object";
return;
@ -901,7 +923,8 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
if (!rj::getSafe(msg, "type", type))
{
qDebug() << "Missing required string member `type` in message root";
qCDebug(chatterinoPubsub)
<< "Missing required string member `type` in message root";
return;
}
@ -913,7 +936,8 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
{
if (!msg.HasMember("data"))
{
qDebug() << "Missing required object member `data` in message root";
qCDebug(chatterinoPubsub)
<< "Missing required object member `data` in message root";
return;
}
@ -921,7 +945,7 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
if (!data.IsObject())
{
qDebug() << "Member `data` must be an object";
qCDebug(chatterinoPubsub) << "Member `data` must be an object";
return;
}
@ -941,7 +965,7 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
}
else
{
qDebug() << "Unknown message type:" << type;
qCDebug(chatterinoPubsub) << "Unknown message type:" << type;
}
}
@ -1002,7 +1026,8 @@ PubSub::WebsocketContextPtr PubSub::onTLSInit(websocketpp::connection_hdl hdl)
}
catch (const std::exception &e)
{
qDebug() << "Exception caught in OnTLSInit:" << e.what();
qCDebug(chatterinoPubsub)
<< "Exception caught in OnTLSInit:" << e.what();
}
return ctx;
@ -1019,12 +1044,14 @@ void PubSub::handleListenResponse(const rapidjson::Document &msg)
if (error.isEmpty())
{
qDebug() << "Successfully listened to nonce" << nonce;
qCDebug(chatterinoPubsub)
<< "Successfully listened to nonce" << nonce;
// Nothing went wrong
return;
}
qDebug() << "PubSub error:" << error << "on nonce" << nonce;
qCDebug(chatterinoPubsub)
<< "PubSub error:" << error << "on nonce" << nonce;
return;
}
}
@ -1035,7 +1062,8 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
if (!rj::getSafe(outerData, "topic", topic))
{
qDebug() << "Missing required string member `topic` in outerData";
qCDebug(chatterinoPubsub)
<< "Missing required string member `topic` in outerData";
return;
}
@ -1043,7 +1071,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
if (!rj::getSafe(outerData, "message", payload))
{
qDebug() << "Expected string message in outerData";
qCDebug(chatterinoPubsub) << "Expected string message in outerData";
return;
}
@ -1053,7 +1081,8 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
if (!res)
{
qDebug() << "Error parsing message '" << payload.c_str()
qCDebug(chatterinoPubsub)
<< "Error parsing message '" << payload.c_str()
<< "' from PubSub:" << rapidjson::GetParseError_En(res.Code());
return;
}
@ -1064,7 +1093,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
if (!rj::getSafe(msg, "type", whisperType))
{
qDebug() << "Bad whisper data";
qCDebug(chatterinoPubsub) << "Bad whisper data";
return;
}
@ -1082,7 +1111,8 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
}
else
{
qDebug() << "Invalid whisper type:" << whisperType.c_str();
qCDebug(chatterinoPubsub)
<< "Invalid whisper type:" << whisperType.c_str();
return;
}
}
@ -1096,7 +1126,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
if (!rj::getSafe(data, "moderation_action", moderationAction))
{
qDebug() << "Missing moderation action in data:"
qCDebug(chatterinoPubsub) << "Missing moderation action in data:"
<< rj::stringify(data).c_str();
return;
}
@ -1105,7 +1135,8 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
if (handlerIt == this->moderationActionHandlers.end())
{
qDebug() << "No handler found for moderation action"
qCDebug(chatterinoPubsub)
<< "No handler found for moderation action"
<< moderationAction.c_str();
return;
}
@ -1118,7 +1149,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
std::string pointEventType;
if (!rj::getSafe(msg, "type", pointEventType))
{
qDebug() << "Bad channel point event data";
qCDebug(chatterinoPubsub) << "Bad channel point event data";
return;
}
@ -1126,33 +1157,36 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
{
if (!rj::getSafeObject(msg, "data", msg))
{
qDebug() << "No data found for redeemed reward";
qCDebug(chatterinoPubsub)
<< "No data found for redeemed reward";
return;
}
if (!rj::getSafeObject(msg, "redemption", msg))
{
qDebug() << "No redemption info found for redeemed reward";
qCDebug(chatterinoPubsub)
<< "No redemption info found for redeemed reward";
return;
}
this->signals_.pointReward.redeemed.invoke(msg);
}
else
{
qDebug() << "Invalid point event type:" << pointEventType.c_str();
qCDebug(chatterinoPubsub)
<< "Invalid point event type:" << pointEventType.c_str();
}
}
else
{
qDebug() << "Unknown topic:" << topic;
qCDebug(chatterinoPubsub) << "Unknown topic:" << topic;
return;
}
}
void PubSub::runThread()
{
qDebug() << "Start pubsub manager thread";
qCDebug(chatterinoPubsub) << "Start pubsub manager thread";
this->websocketClient.run();
qDebug() << "Done with pubsub manager thread";
qCDebug(chatterinoPubsub) << "Done with pubsub manager thread";
}
} // namespace chatterino

View file

@ -1,5 +1,6 @@
#pragma once
#include "providers/twitch/ChatterinoWebSocketppLogger.hpp"
#include "providers/twitch/PubsubActions.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
@ -9,6 +10,8 @@
#include <pajlada/signals/signal.hpp>
#include <websocketpp/client.hpp>
#include <websocketpp/config/asio_client.hpp>
#include <websocketpp/extensions/permessage_deflate/disabled.hpp>
#include <websocketpp/logger/basic.hpp>
#include <atomic>
#include <chrono>
@ -21,8 +24,23 @@
namespace chatterino {
using WebsocketClient =
websocketpp::client<websocketpp::config::asio_tls_client>;
struct chatterinoconfig : public websocketpp::config::asio_tls_client {
typedef websocketpp::log::chatterinowebsocketpplogger<
concurrency_type, websocketpp::log::elevel>
elog_type;
typedef websocketpp::log::chatterinowebsocketpplogger<
concurrency_type, websocketpp::log::alevel>
alog_type;
struct permessage_deflate_config {
};
typedef websocketpp::extensions::permessage_deflate::disabled<
permessage_deflate_config>
permessage_deflate_type;
};
using WebsocketClient = websocketpp::client<chatterinoconfig>;
using WebsocketHandle = websocketpp::connection_hdl;
using WebsocketErrorCode = websocketpp::lib::error_code;

View file

@ -3,6 +3,7 @@
#include <boost/asio.hpp>
#include <boost/asio/steady_timer.hpp>
#include <memory>
#include "common/QLogging.hpp"
#include "util/RapidjsonHelpers.hpp"
namespace chatterino {
@ -34,7 +35,8 @@ void runAfter(boost::asio::io_service &ioService, Duration duration,
timer->async_wait([timer, cb](const boost::system::error_code &ec) {
if (ec)
{
qDebug() << "Error in runAfter:" << ec.message().c_str();
qCDebug(chatterinoPubsub)
<< "Error in runAfter:" << ec.message().c_str();
return;
}
@ -52,7 +54,8 @@ void runAfter(std::shared_ptr<boost::asio::steady_timer> timer,
timer->async_wait([timer, cb](const boost::system::error_code &ec) {
if (ec)
{
qDebug() << "Error in runAfter:" << ec.message().c_str();
qCDebug(chatterinoPubsub)
<< "Error in runAfter:" << ec.message().c_str();
return;
}

View file

@ -6,6 +6,7 @@
#include "common/Env.hpp"
#include "common/NetworkRequest.hpp"
#include "common/Outcome.hpp"
#include "common/QLogging.hpp"
#include "providers/twitch/TwitchCommon.hpp"
#include "providers/twitch/api/Helix.hpp"
#include "singletons/Emotes.hpp"
@ -133,7 +134,8 @@ void TwitchAccount::loadIgnores()
TwitchUser ignoredUser;
if (!rj::getSafe(userIt->value, ignoredUser))
{
qDebug() << "Error parsing twitch user JSON"
qCWarning(chatterinoTwitch)
<< "Error parsing twitch user JSON"
<< rj::stringify(userIt->value).c_str();
continue;
}
@ -338,14 +340,15 @@ std::set<TwitchUser> TwitchAccount::getIgnores() const
void TwitchAccount::loadEmotes()
{
qDebug() << "Loading Twitch emotes for user" << this->getUserName();
qCDebug(chatterinoTwitch)
<< "Loading Twitch emotes for user" << this->getUserName();
const auto &clientID = this->getOAuthClient();
const auto &oauthToken = this->getOAuthToken();
if (clientID.isEmpty() || oauthToken.isEmpty())
{
qDebug() << "Missing Client ID or OAuth token";
qCDebug(chatterinoTwitch) << "Missing Client ID or OAuth token";
return;
}
@ -356,7 +359,8 @@ void TwitchAccount::loadEmotes()
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
.onError([=](NetworkResult result) {
qDebug() << "[TwitchAccount::loadEmotes] Error" << result.status();
qCWarning(chatterinoTwitch)
<< "[TwitchAccount::loadEmotes] Error" << result.status();
if (result.status() == 203)
{
// onFinished(FollowResult_NotFollowing);
@ -394,8 +398,8 @@ void TwitchAccount::autoModAllow(const QString msgID)
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
.onError([=](NetworkResult result) {
qDebug() << "[TwitchAccounts::autoModAllow] Error"
<< result.status();
qCWarning(chatterinoTwitch)
<< "[TwitchAccounts::autoModAllow] Error" << result.status();
})
.execute();
}
@ -413,8 +417,8 @@ void TwitchAccount::autoModDeny(const QString msgID)
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
.onError([=](NetworkResult result) {
qDebug() << "[TwitchAccounts::autoModDeny] Error"
<< result.status();
qCWarning(chatterinoTwitch)
<< "[TwitchAccounts::autoModDeny] Error" << result.status();
})
.execute();
}
@ -429,7 +433,8 @@ void TwitchAccount::parseEmotes(const rapidjson::Document &root)
auto emoticonSets = root.FindMember("emoticon_sets");
if (emoticonSets == root.MemberEnd() || !emoticonSets->value.IsObject())
{
qDebug() << "No emoticon_sets in load emotes response";
qCWarning(chatterinoTwitch)
<< "No emoticon_sets in load emotes response";
return;
}
@ -445,21 +450,22 @@ void TwitchAccount::parseEmotes(const rapidjson::Document &root)
{
if (!emoteJSON.IsObject())
{
qDebug() << "Emote value was invalid";
qCWarning(chatterinoTwitch) << "Emote value was invalid";
return;
}
uint64_t idNumber;
if (!rj::getSafe(emoteJSON, "id", idNumber))
{
qDebug() << "No ID key found in Emote value";
qCWarning(chatterinoTwitch) << "No ID key found in Emote value";
return;
}
QString _code;
if (!rj::getSafe(emoteJSON, "code", _code))
{
qDebug() << "No code key found in Emote value";
qCWarning(chatterinoTwitch)
<< "No code key found in Emote value";
return;
}
@ -486,7 +492,7 @@ void TwitchAccount::loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet)
{
if (!emoteSet)
{
qDebug() << "null emote set sent";
qCWarning(chatterinoTwitch) << "null emote set sent";
return;
}
@ -502,7 +508,7 @@ void TwitchAccount::loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet)
NetworkRequest(Env::get().twitchEmoteSetResolverUrl.arg(emoteSet->key))
.cache()
.onError([](NetworkResult result) {
qDebug() << "Error code" << result.status()
qCWarning(chatterinoTwitch) << "Error code" << result.status()
<< "while loading emote set data";
})
.onSuccess([emoteSet](auto result) -> Outcome {
@ -525,7 +531,8 @@ void TwitchAccount::loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet)
return Failure;
}
qDebug() << "Loaded twitch emote set data for" << emoteSet->key;
qCDebug(chatterinoTwitch)
<< "Loaded twitch emote set data for" << emoteSet->key;
auto name = channelName;
name.detach();

View file

@ -1,6 +1,7 @@
#include "providers/twitch/TwitchAccountManager.hpp"
#include "common/Common.hpp"
#include "common/QLogging.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/TwitchCommon.hpp"
#include "providers/twitch/api/Helix.hpp"
@ -105,23 +106,26 @@ void TwitchAccountManager::reloadUsers()
switch (this->addUser(userData))
{
case AddUserResponse::UserAlreadyExists: {
qDebug() << "User" << userData.username << "already exists";
qCDebug(chatterinoTwitch)
<< "User" << userData.username << "already exists";
// Do nothing
}
break;
case AddUserResponse::UserValuesUpdated: {
qDebug() << "User" << userData.username
qCDebug(chatterinoTwitch)
<< "User" << userData.username
<< "already exists, and values updated!";
if (userData.username == this->getCurrent()->getUserName())
{
qDebug() << "It was the current user, so we need to "
qCDebug(chatterinoTwitch)
<< "It was the current user, so we need to "
"reconnect stuff!";
this->currentUserChanged.invoke();
}
}
break;
case AddUserResponse::UserAdded: {
qDebug() << "Added user" << userData.username;
qCDebug(chatterinoTwitch) << "Added user" << userData.username;
listUpdated = true;
}
break;
@ -142,14 +146,15 @@ void TwitchAccountManager::load()
auto user = this->findUserByUsername(newUsername);
if (user)
{
qDebug() << "Twitch user updated to" << newUsername;
qCDebug(chatterinoTwitch)
<< "Twitch user updated to" << newUsername;
getHelix()->update(user->getOAuthClient(), user->getOAuthToken());
getKraken()->update(user->getOAuthClient(), user->getOAuthToken());
this->currentUser_ = user;
}
else
{
qDebug() << "Twitch user updated to anonymous";
qCDebug(chatterinoTwitch) << "Twitch user updated to anonymous";
this->currentUser_ = this->anonymousUser_;
}

View file

@ -31,6 +31,7 @@
#include <QJsonValue>
#include <QThread>
#include <QTimer>
#include "common/QLogging.hpp"
namespace chatterino {
namespace {
@ -148,7 +149,7 @@ TwitchChannel::TwitchChannel(const QString &name,
, mod_(false)
, titleRefreshedTime_(QTime::currentTime().addSecs(-TITLE_REFRESH_PERIOD))
{
qDebug() << "[TwitchChannel" << name << "] Opened";
qCDebug(chatterinoTwitch) << "[TwitchChannel" << name << "] Opened";
this->liveStatusChanged.connect([this]() {
if (this->isLive() == 1)
@ -305,8 +306,8 @@ void TwitchChannel::sendMessage(const QString &message)
return;
}
qDebug() << "[TwitchChannel" << this->getName()
<< "] Send message:" << message;
qCDebug(chatterinoTwitch)
<< "[TwitchChannel" << this->getName() << "] Send message:" << message;
// Do last message processing
QString parsedMessage = app->emotes->emojis.replaceShortCodes(message);
@ -334,7 +335,7 @@ void TwitchChannel::sendMessage(const QString &message)
if (messageSent)
{
qDebug() << "sent";
qCDebug(chatterinoTwitch) << "sent";
this->lastSentMessage_ = parsedMessage;
}
}
@ -593,7 +594,7 @@ void TwitchChannel::refreshLiveStatus()
if (roomID.isEmpty())
{
qDebug() << "[TwitchChannel" << this->getName()
qCDebug(chatterinoTwitch) << "[TwitchChannel" << this->getName()
<< "] Refreshing live status (Missing ID)";
this->setLive(false);
return;
@ -908,7 +909,8 @@ boost::optional<CheerEmote> TwitchChannel::cheerEmote(const QString &string)
int bitAmount = amount.toInt(&ok);
if (!ok)
{
qDebug() << "Error parsing bit amount in cheerEmote";
qCDebug(chatterinoTwitch)
<< "Error parsing bit amount in cheerEmote";
}
for (const auto &emote : set.cheerEmotes)
{

View file

@ -1,4 +1,5 @@
#include "providers/twitch/TwitchHelpers.hpp"
#include "common/QLogging.hpp"
namespace chatterino {
@ -6,7 +7,7 @@ bool trimChannelName(const QString &channelName, QString &outChannelName)
{
if (channelName.length() < 2)
{
qDebug() << "channel name length below 2";
qCDebug(chatterinoTwitch) << "channel name length below 2";
return false;
}

View file

@ -6,6 +6,7 @@
#include "Application.hpp"
#include "common/Common.hpp"
#include "common/Env.hpp"
#include "common/QLogging.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "messages/Message.hpp"
#include "messages/MessageBuilder.hpp"
@ -55,7 +56,7 @@ void TwitchIrcServer::initializeConnection(IrcConnection *connection,
std::shared_ptr<TwitchAccount> account =
getApp()->accounts->twitch.getCurrent();
qDebug() << "logging in as" << account->getUserName();
qCDebug(chatterinoTwitch) << "logging in as" << account->getUserName();
QString username = account->getUserName();
QString oauthToken = account->getOAuthToken();

View file

@ -25,6 +25,7 @@
#include <QMediaPlayer>
#include <QStringRef>
#include <boost/variant.hpp>
#include "common/QLogging.hpp"
namespace {
@ -712,7 +713,8 @@ void TwitchMessageBuilder::runIgnoreReplaces(
{
if ((*copy).ptr == nullptr)
{
qDebug() << "remem nullptr" << (*copy).name.string;
qCDebug(chatterinoTwitch)
<< "remem nullptr" << (*copy).name.string;
}
}
std::vector<TwitchEmoteOccurence> v(it, twitchEmotes.end());
@ -749,7 +751,8 @@ void TwitchMessageBuilder::runIgnoreReplaces(
{
if (emote.second == nullptr)
{
qDebug() << "emote null" << emote.first.string;
qCDebug(chatterinoTwitch)
<< "emote null" << emote.first.string;
}
twitchEmotes.push_back(TwitchEmoteOccurence{
startIndex + pos,
@ -821,7 +824,8 @@ void TwitchMessageBuilder::runIgnoreReplaces(
{
if (tup.ptr == nullptr)
{
qDebug() << "v nullptr" << tup.name.string;
qCDebug(chatterinoTwitch)
<< "v nullptr" << tup.name.string;
continue;
}
QRegularExpression emoteregex(
@ -885,7 +889,8 @@ void TwitchMessageBuilder::runIgnoreReplaces(
{
if (tup.ptr == nullptr)
{
qDebug() << "v nullptr" << tup.name.string;
qCDebug(chatterinoTwitch)
<< "v nullptr" << tup.name.string;
continue;
}
QRegularExpression emoteregex(
@ -955,7 +960,8 @@ void TwitchMessageBuilder::appendTwitchEmote(
start, end, app->emotes->twitch.getOrCreateEmote(id, name), name};
if (emoteOccurence.ptr == nullptr)
{
qDebug() << "nullptr" << emoteOccurence.name.string;
qCDebug(chatterinoTwitch)
<< "nullptr" << emoteOccurence.name.string;
}
vec.push_back(std::move(emoteOccurence));
}

View file

@ -1,6 +1,7 @@
#include "providers/twitch/api/Helix.hpp"
#include "common/Outcome.hpp"
#include "common/QLogging.hpp"
namespace chatterino {
@ -320,14 +321,14 @@ NetworkRequest Helix::makeRequest(QString url, QUrlQuery urlQuery)
if (this->clientId.isEmpty())
{
qDebug()
qCDebug(chatterinoTwitch)
<< "Helix::makeRequest called without a client ID set BabyRage";
// return boost::none;
}
if (this->oauthToken.isEmpty())
{
qDebug()
qCDebug(chatterinoTwitch)
<< "Helix::makeRequest called without an oauth token set BabyRage";
// return boost::none;
}

View file

@ -1,6 +1,7 @@
#include "providers/twitch/api/Kraken.hpp"
#include "common/Outcome.hpp"
#include "common/QLogging.hpp"
#include "providers/twitch/TwitchCommon.hpp"
namespace chatterino {
@ -54,7 +55,7 @@ NetworkRequest Kraken::makeRequest(QString url, QUrlQuery urlQuery)
if (this->clientId.isEmpty())
{
qDebug()
qCDebug(chatterinoTwitch)
<< "Kraken::makeRequest called without a client ID set BabyRage";
}

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;
}
}

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();

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;

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);

View file

@ -14,6 +14,7 @@
#include <QMimeDatabase>
#include <QMutex>
#include <QSaveFile>
#include "common/QLogging.hpp"
#define UPLOAD_DELAY 2000
// Delay between uploads in milliseconds
@ -160,7 +161,7 @@ void uploadImageToNuuls(RawImageData imageData, ChannelPtr channel,
? ""
: getLinkFromResponse(
result, getSettings()->imageUploaderDeletionLink);
qDebug() << link << deletionLink;
qCDebug(chatterinoNuulsuploader) << link << deletionLink;
textEdit.insertPlainText(link + " ");
if (uploadQueue.empty())
{

View file

@ -8,6 +8,7 @@
#include <QErrorMessage>
#include <QFileInfo>
#include <QProcess>
#include "common/QLogging.hpp"
#include <functional>
@ -92,7 +93,7 @@ namespace {
}
else
{
qDebug() << "Error occured" << err;
qCWarning(chatterinoStreamlink) << "Error occured" << err;
}
p->deleteLater();
@ -119,7 +120,7 @@ void getStreamQualities(const QString &channelURL,
[=](int res) {
if (res != 0)
{
qDebug() << "Got error code" << res;
qCWarning(chatterinoStreamlink) << "Got error code" << res;
// return;
}
QString lastLine = QString(p->readAllStandardOutput());

View file

@ -7,6 +7,7 @@
#include <QTimer>
#include <QVBoxLayout>
#include "common/QLogging.hpp"
#ifdef USEWINSDK
# include "util/WindowsHelper.hpp"
@ -192,7 +193,8 @@ void AttachedWindow::attachToHwnd(void *_attachedPtr)
!qfilename.endsWith("brave.exe"))
{
qDebug() << "NM Illegal caller" << qfilename;
qCWarning(chatterinoWidget)
<< "NM Illegal caller" << qfilename;
this->timer_.stop();
this->deleteLater();
return;
@ -241,7 +243,7 @@ void AttachedWindow::updateWindowRect(void *_attachedPtr)
if (::GetLastError() != 0)
{
qDebug() << "NM GetLastError()" << ::GetLastError();
qCWarning(chatterinoWidget) << "NM GetLastError()" << ::GetLastError();
this->timer_.stop();
this->deleteLater();

View file

@ -1,6 +1,7 @@
#include "widgets/Notebook.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "singletons/Settings.hpp"
#include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp"
@ -153,7 +154,7 @@ void Notebook::select(QWidget *page)
}
else
{
qDebug()
qCDebug(chatterinoWidget)
<< "Notebook: selected child of page doesn't exist anymore";
}
}

View file

@ -1,6 +1,7 @@
#include "widgets/Scrollbar.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "singletons/Settings.hpp"
#include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp"
@ -228,7 +229,8 @@ void Scrollbar::setCurrentValue(qreal value)
void Scrollbar::printCurrentState(const QString &prefix) const
{
qDebug() << prefix //
qCDebug(chatterinoWidget)
<< prefix //
<< "Current value: " << this->getCurrentValue() //
<< ". Maximum: " << this->getMaximum() //
<< ". Minimum: " << this->getMinimum() //

View file

@ -3,6 +3,7 @@
#include "Application.hpp"
#include "common/Common.hpp"
#include "common/NetworkRequest.hpp"
#include "common/QLogging.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "util/Helpers.hpp"
@ -108,11 +109,11 @@ BasicLoginWidget::BasicLoginWidget()
this->ui_.layout.addWidget(&this->ui_.unableToOpenBrowserHelper);
connect(&this->ui_.loginButton, &QPushButton::clicked, [this, logInLink]() {
qDebug() << "open login in browser";
qCDebug(chatterinoWidget) << "open login in browser";
auto res = QDesktopServices::openUrl(QUrl(logInLink));
if (!res)
{
qDebug() << "open login in browser failed";
qCWarning(chatterinoWidget) << "open login in browser failed";
this->ui_.unableToOpenBrowserHelper.show();
}
});
@ -152,7 +153,7 @@ BasicLoginWidget::BasicLoginWidget()
}
else
{
qDebug() << "Unknown key in code: " << key;
qCWarning(chatterinoWidget) << "Unknown key in code: " << key;
}
}

View file

@ -1,5 +1,6 @@
#include "QualityPopup.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "singletons/WindowManager.hpp"
#include "util/StreamLink.hpp"
#include "widgets/Window.hpp"
@ -55,7 +56,8 @@ void QualityPopup::okButtonClicked()
}
catch (const Exception &ex)
{
qDebug() << "Exception caught trying to open streamlink:" << ex.what();
qCWarning(chatterinoWidget)
<< "Exception caught trying to open streamlink:" << ex.what();
}
this->close();

View file

@ -15,6 +15,7 @@
#include "Application.hpp"
#include "common/Common.hpp"
#include "common/QLogging.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/commands/CommandController.hpp"
#include "debug/Benchmark.hpp"
@ -892,7 +893,8 @@ void ChannelView::messageReplaced(size_t index, MessagePtr &replacement)
auto snapshot = this->messages_.getSnapshot();
if (index >= snapshot.size())
{
qDebug() << "Tried to replace out of bounds message. Index:" << index
qCDebug(chatterinoWidget)
<< "Tried to replace out of bounds message. Index:" << index
<< ". Length:" << snapshot.size();
return;
}

View file

@ -1,6 +1,7 @@
#include "AboutPage.hpp"
#include "common/Modes.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "util/LayoutCreator.hpp"
#include "util/RemoveScrollAreaBackground.hpp"
@ -166,7 +167,8 @@ AboutPage::AboutPage()
if (contributorParts.size() != 4)
{
qDebug() << "Missing parts in line" << line;
qCDebug(chatterinoWidget)
<< "Missing parts in line" << line;
continue;
}

View file

@ -4,6 +4,7 @@
#include <boost/variant.hpp>
#include "Application.hpp"
#include "common/ChatterinoSetting.hpp"
#include "common/QLogging.hpp"
#include "singletons/WindowManager.hpp"
#include "widgets/helper/SignalLabel.hpp"
@ -190,7 +191,7 @@ public:
protected:
void resizeEvent(QResizeEvent *ev) override
{
qDebug() << ev->size();
qCDebug(chatterinoWidget) << ev->size();
}
private:

View file

@ -4,6 +4,7 @@
#include "common/Common.hpp"
#include "common/Env.hpp"
#include "common/NetworkRequest.hpp"
#include "common/QLogging.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "providers/twitch/EmoteValue.hpp"
#include "providers/twitch/TwitchChannel.hpp"
@ -639,7 +640,8 @@ void Split::openInStreamlink()
}
catch (const Exception &ex)
{
qDebug() << "Error in doOpenStreamlink:" << ex.what();
qCWarning(chatterinoWidget)
<< "Error in doOpenStreamlink:" << ex.what();
}
}