Skip to content

Commit

Permalink
Update logging
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel committed Feb 16, 2024
1 parent 05ccfd6 commit 744e61d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ To use this module, follow these instructions to [add a module from the Viam Reg

Navigate to the **Config** tab of your machine's page in [the Viam app](https://app.viam.com/).
Click on the **Components** subtab and click **Create component**.
Select the `<INSERT API NAME>` type, then select the `<INSERT MODEL>` model.
Enter a name for your <INSERT API NAME> and click **Create**.
Select the `sensor` type, then select the `sync-at-time:timesyncsensor` model.
Click **Add module**, then enter a name for your sensor and click **Create**.

On the new component panel, copy and paste the following attribute template into your sensor’s **Attributes** box:

Expand Down Expand Up @@ -59,13 +59,13 @@ The following attributes are available for the `naomi:sync-at-time:timesyncsenso

On your machine's **Config** tab, switch to **JSON** mode and add a `selective_syncer_name` with the name for the sensor you configured:

```json {class="line-numbers linkable-line-numbers" data-line="6"}
```json
{
"attributes": {
"additional_sync_paths": [],
"capture_dir": "",
"capture_disabled": false,
"selective_syncer_name": "selective-syncer",
"selective_syncer_name": "<SENSOR-NAME>",
"sync_disabled": false,
"sync_interval_mins": 0.1,
"tags": []
Expand Down
Binary file removed sync-at-time
Binary file not shown.
5 changes: 3 additions & 2 deletions timesyncsensor/timesyncsensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ func (s *timeSyncer) Reconfigure(ctx context.Context, deps resource.Dependencies
s.start = sensorConfig.Start
s.end = sensorConfig.End
s.name = conf.ResourceName()
s.logger.Info("Start time and end time have changed to %s and %s.", s.start, s.end)
s.logger.Info("Start time for sync now: %+s", s.start)
s.logger.Info("End time for sync now: %+s", s.end)

return nil
}
Expand All @@ -126,7 +127,7 @@ func (s *timeSyncer) Readings(context.Context, map[string]interface{}) (map[stri

zone, err := time.LoadLocation(s.zone)
if err != nil {
s.logger.Error("Time zone %s cannot be loaded", s.zone)
s.logger.Error("Time zone cannot be loaded: %+s", s.zone)
}

startTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(),
Expand Down

0 comments on commit 744e61d

Please sign in to comment.