From: Florian Forster Date: Sun, 4 Feb 2018 08:26:05 +0000 (+0100) Subject: Litter the sleep code with debug log entries. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a05bb612a8b3c7b66fc6f841040c69b87350e63e;p=kraftakt.git Litter the sleep code with debug log entries. --- diff --git a/gfit/gfit.go b/gfit/gfit.go index 9a1c6f4..3e406b4 100644 --- a/gfit/gfit.go +++ b/gfit/gfit.go @@ -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) } diff --git a/kraftakt.go b/kraftakt.go index 4381596..40f0546 100644 --- a/kraftakt.go +++ b/kraftakt.go @@ -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) }