Litter the sleep code with debug log entries.
authorFlorian Forster <ff@octo.it>
Sun, 4 Feb 2018 08:26:05 +0000 (09:26 +0100)
committerFlorian Forster <ff@octo.it>
Sun, 4 Feb 2018 08:26:05 +0000 (09:26 +0100)
gfit/gfit.go
kraftakt.go

index 9a1c6f4..3e406b4 100644 (file)
@@ -248,6 +248,7 @@ func (a Activity) String() string {
 
 func (c *Client) SetActivities(ctx context.Context, activities []Activity, startOfDay time.Time) error {
        if len(activities) == 0 {
+               log.Debugf(ctx, "SetActivities(): len(activities) == 0")
                return nil
        }
 
@@ -301,9 +302,11 @@ Next:
        }
 
        if len(dataPoints) == 0 {
+               log.Debugf(ctx, "SetActivities(): len(dataPoints) == 0")
                return nil
        }
 
+       log.Debugf(ctx, "SetActivities(): calling c.DatasetPatch(%q)", dataStreamID)
        return c.DatasetPatch(ctx, dataStreamID, dataPoints)
 }
 
index 4381596..40f0546 100644 (file)
@@ -491,6 +491,7 @@ func sleepNotification(ctx context.Context, s *fitbit.Subscription) error {
        if err != nil {
                return err
        }
+       log.Debugf(ctx, "fitbitClient.Sleep(%v) returned %d sleep stages", tm, len(sleep.Stages))
 
        var activities []gfit.Activity
        for _, stg := range sleep.Stages {
@@ -520,6 +521,7 @@ func sleepNotification(ctx context.Context, s *fitbit.Subscription) error {
                return gfitErr
        }
 
+       log.Debugf(ctx, "passing %d activities to gfitClient.SetActivities()", len(activities))
        if err := gfitClient.SetActivities(ctx, activities, tm); err != nil {
                return fmt.Errorf("SetActivities() = %v", err)
        }