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
+24 -17
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,8 +134,9 @@ void TwitchAccount::loadIgnores()
TwitchUser ignoredUser;
if (!rj::getSafe(userIt->value, ignoredUser))
{
qDebug() << "Error parsing twitch user JSON"
<< rj::stringify(userIt->value).c_str();
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,8 +508,8 @@ void TwitchAccount::loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet)
NetworkRequest(Env::get().twitchEmoteSetResolverUrl.arg(emoteSet->key))
.cache()
.onError([](NetworkResult result) {
qDebug() << "Error code" << result.status()
<< "while loading emote set data";
qCWarning(chatterinoTwitch) << "Error code" << result.status()
<< "while loading emote set data";
})
.onSuccess([emoteSet](auto result) -> Outcome {
auto root = result.parseRapidJson();
@@ -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();