From 6d5f45f39260ccd16ce776dfd5881f5e6f5ad34b Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Tue, 11 May 2021 20:51:36 +0200
Subject: [PATCH] Add more debug output

---
 src/oauth.rs | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/oauth.rs b/src/oauth.rs
index c6f913c..39ddd25 100644
--- a/src/oauth.rs
+++ b/src/oauth.rs
@@ -154,11 +154,17 @@ fn get_data(conf: &Config, prefix: &str, endpoint: &str, param: String, token: &
 pub fn get_data_jq<T: for<'de> Deserialize<'de>>(conf: &Config, prefix: &str, endpoint: &str, param: String, token: &BasicTokenResponse, multi: bool) -> Result<T, Box<dyn error::Error>> {
     let res: Option<String> = get_optional(&conf, &full_key(vec![prefix, "maps", endpoint]));
     let jq_code = match res {
-        Some(s) => match multi {
-            true => "map(".to_string() + &s + ")",
-            false => s
+        Some(s) => {
+            debug!("Found jq mapping program for endpoint {}", endpoint);
+            match multi {
+                true => "map(".to_string() + &s + ")",
+                false => s
+            }
         },
-        None => ".".to_string()
+        None => {
+            debug!("No jq mapping program for endpoint {}; using default (no-op)", endpoint);
+            ".".to_string()
+        }
     };
     let mut jq_prog = jq_rs::compile(&jq_code)?;
 
-- 
GitLab