From eb7b9c066cc2a1cd5b5e0091b45fb0bf38993c88 Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <blacklight86@gmail.com>
Date: Tue, 19 Mar 2019 11:29:53 +0000
Subject: [PATCH] Logging info about processed Fit entries to debug why we
 don't always get all the new events

---
 platypush/backend/google/fit.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/platypush/backend/google/fit.py b/platypush/backend/google/fit.py
index 430e58e03..cebfaea3e 100644
--- a/platypush/backend/google/fit.py
+++ b/platypush/backend/google/fit.py
@@ -62,8 +62,11 @@ class GoogleFitBackend(Backend):
 
         while not self.should_stop():
             new_last_timestamp = last_timestamp
+            self.logger.info('Scanning fit data source, last seen timestamp: {}'.
+                             format(last_timestamp))
 
             for data_source in self.data_sources:
+                data_source_last_timestamp = 0
                 data_points = get_plugin('google.fit').get_data(
                     user_id=self.user_id, data_source_id=data_source).output
 
@@ -85,6 +88,12 @@ class GoogleFitBackend(Backend):
                         ))
 
                     new_last_timestamp = max(dp_time, new_last_timestamp)
+                    data_source_last_timestamp = max(dp_time, data_source_last_timestamp)
+
+                self.logger.info('Got {} entries from data source {}, last timestamp: {}'.
+                                 format(len(data_points), data_source,
+                                        data_source_last_timestamp))
+
 
             last_timestamp = new_last_timestamp