input/tidal: add some debug logging

This commit is contained in:
Max Kellermann 2018-01-24 15:19:31 +01:00
parent 3461580b34
commit c7c087a0d2
2 changed files with 16 additions and 0 deletions

View File

@ -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 <stdexcept>
#include <memory>
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<Mutex> protect(mutex);
track_request.reset();

View File

@ -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<Mutex> protect(mutex);
login_request.reset();