From 52fd6ffadccb8f071c78061ac3478a211881e5fe Mon Sep 17 00:00:00 2001 From: Jim Broadus Date: Wed, 12 Feb 2020 21:36:07 -0800 Subject: [PATCH] Add a logging category to log all network requests. New logging class NetworkRequests disabled by default, but can be enabled with the command line option. --- ext/libclementine-common/core/logging.cpp | 5 ++++- src/core/network.cpp | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ext/libclementine-common/core/logging.cpp b/ext/libclementine-common/core/logging.cpp index a1038d900..54eb99735 100644 --- a/ext/libclementine-common/core/logging.cpp +++ b/ext/libclementine-common/core/logging.cpp @@ -42,7 +42,10 @@ static Level sDefaultLevel = Level_Debug; static QMap* sClassLevels = nullptr; static QIODevice* sNullDevice = nullptr; -const char* kDefaultLogLevels = "GstEnginePipelineCallbacks:2,*:3"; +const char* kDefaultLogLevels = + "GstEnginePipelineCallbacks:2," + "NetworkRequests:2," + "*:3"; static const char* kMessageHandlerMagic = "__logging_message__"; static const int kMessageHandlerMagicLength = strlen(kMessageHandlerMagic); diff --git a/src/core/network.cpp b/src/core/network.cpp index a2f79c00a..7f29dec41 100644 --- a/src/core/network.cpp +++ b/src/core/network.cpp @@ -17,6 +17,7 @@ along with Clementine. If not, see . */ +#include "core/logging.h" #include "network.h" #include @@ -95,6 +96,7 @@ NetworkAccessManager::NetworkAccessManager(int timeout, QObject* parent) QNetworkReply* NetworkAccessManager::createRequest( Operation op, const QNetworkRequest& request, QIODevice* outgoingData) { + qLogCat(Debug, "NetworkRequests") << request.url(); QByteArray user_agent = QString("%1 %2") .arg(QCoreApplication::applicationName(), QCoreApplication::applicationVersion())