From bc6bd8a2b8b84a79dd77b81d6a25b661c5d1d1ca Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sun, 16 Dec 2018 14:14:41 +0100 Subject: Add optional debugging code Compile *without* -DNDEBUG. The environment variable PIANOBAR_DEBUG accepts a bitfield which enables (1) network (2) audio (4) UI debug messages. --- src/ui.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ui.c') diff --git a/src/ui.c b/src/ui.c index 6ccc2af..99b74c3 100644 --- a/src/ui.c +++ b/src/ui.c @@ -40,6 +40,7 @@ THE SOFTWARE. #include #include "ui.h" +#include "debug.h" #include "ui_readline.h" typedef int (*BarSortFunc_t) (const void *, const void *); @@ -189,6 +190,7 @@ static CURLcode BarPianoHttpRequest (CURL * const http, req->secure ? settings->rpcTlsPort : "80", req->urlPath); assert (ret >= 0 && ret <= (int) sizeof (url)); + debugPrint (DEBUG_NETWORK, "← %s\n", url); /* save the previous interrupt destination */ prevint = interrupted; @@ -261,6 +263,7 @@ static CURLcode BarPianoHttpRequest (CURL * const http, curl_slist_free_all (list); req->responseData = buffer.data; + debugPrint (DEBUG_NETWORK, "→ %s\n", req->responseData); interrupted = prevint; -- cgit v1.2.3