From c7c087a0d2a871c006a4dd112919aecd0d9ded76 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 24 Jan 2018 15:19:31 +0100 Subject: [PATCH] input/tidal: add some debug logging --- src/input/plugins/TidalInputPlugin.cxx | 7 +++++++ src/input/plugins/TidalSessionManager.cxx | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/src/input/plugins/TidalInputPlugin.cxx b/src/input/plugins/TidalInputPlugin.cxx index 6fb2bf524..9de31fda7 100644 --- a/src/input/plugins/TidalInputPlugin.cxx +++ b/src/input/plugins/TidalInputPlugin.cxx @@ -28,11 +28,15 @@ #include "input/InputPlugin.hxx" #include "config/Block.hxx" #include "thread/Mutex.hxx" +#include "util/Domain.hxx" #include "util/StringCompare.hxx" +#include "Log.hxx" #include #include +static constexpr Domain tidal_domain("tidal"); + static TidalSessionManager *tidal_session; class TidalInputStream final @@ -100,6 +104,9 @@ TidalInputStream::OnTidalSession() noexcept void TidalInputStream::OnTidalTrackSuccess(std::string url) noexcept { + FormatDebug(tidal_domain, "Tidal track '%s' resolves to %s", + track_id.c_str(), url.c_str()); + const std::lock_guard protect(mutex); track_request.reset(); diff --git a/src/input/plugins/TidalSessionManager.cxx b/src/input/plugins/TidalSessionManager.cxx index 35b25c9a1..bfb6f08bc 100644 --- a/src/input/plugins/TidalSessionManager.cxx +++ b/src/input/plugins/TidalSessionManager.cxx @@ -20,6 +20,11 @@ #include "config.h" #include "TidalSessionManager.hxx" #include "lib/curl/Global.hxx" +#include "util/Domain.hxx" + +#include "Log.hxx" + +static constexpr Domain tidal_domain("tidal"); TidalSessionManager::TidalSessionManager(EventLoop &event_loop, const char *_base_url, const char *_token, @@ -53,6 +58,8 @@ TidalSessionManager::AddLoginHandler(TidalSessionHandler &h) noexcept if (session.empty()) { // TODO: throttle login attempts? + LogDebug(tidal_domain, "Sending login request"); + std::string login_uri(base_url); login_uri += "/login/username"; @@ -76,6 +83,8 @@ TidalSessionManager::AddLoginHandler(TidalSessionHandler &h) noexcept void TidalSessionManager::OnTidalLoginSuccess(std::string _session) noexcept { + FormatDebug(tidal_domain, "Login successful, session=%s", _session.c_str()); + { const std::lock_guard protect(mutex); login_request.reset();