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.
This commit is contained in:
Jim Broadus 2020-02-12 21:36:07 -08:00 committed by John Maguire
parent a5db937d23
commit 52fd6ffadc
2 changed files with 6 additions and 1 deletions

View File

@ -42,7 +42,10 @@ static Level sDefaultLevel = Level_Debug;
static QMap<QString, Level>* 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);

View File

@ -17,6 +17,7 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "core/logging.h"
#include "network.h"
#include <QCoreApplication>
@ -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())